Skip to content

fix: Ensure utils:curl re-runs when input URLs or the library target's commit hash changes. #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion taskfiles/utils-remote.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,15 @@ tasks:
label: "{{.TASK}}-{{.OUTPUT_FILE}}"
vars:
OUTPUT_FILE: "{{default (base .URL) .OUTPUT_FILE}}"
URL_FILE: "{{.OUTPUT_FILE | replace \".\" \"#\"}}.url"
requires:
vars: ["FILE_SHA256", "URL"]
generates: ["{{.OUTPUT_FILE}}"]
generates: ["{{.OUTPUT_FILE}}", "{{.URL_FILE}}"]
status:
- >-
diff
<(echo "{{.URL}}")
<(cat "{{.URL_FILE}}")
- >-
diff
<(echo "{{.FILE_SHA256}}")
Expand All @@ -26,6 +31,7 @@ tasks:
cmds:
- |-
mkdir -p "{{dir .OUTPUT_FILE}}"
echo "{{.URL}}" > "{{.URL_FILE}}"
max_attempts=3
attempt=1
while [ $attempt -le $max_attempts ]; do
Expand All @@ -47,6 +53,12 @@ tasks:
echo "Failed to download after $max_attempts attempts."
exit 1
fi
- "echo Verifying the commit hash of {{.OUTPUT_FILE}}."
- >-
diff
<(echo "{{.FILE_SHA256}}")
<(openssl dgst -sha256 "{{.OUTPUT_FILE}}"
| awk '{print $2}')

# Runs curl to download the tar file from the given URL and extracts its contents.
#
Expand Down