Skip to content
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
25 changes: 22 additions & 3 deletions exports/taskfiles/utils/remote.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,28 @@ tasks:
echo "Failed to download after $max_attempts attempts."
exit 1
fi
diff \
<(echo "{{.FILE_SHA256}}") \
<(openssl dgst -sha256 "{{.OUTPUT_FILE}}" | awk '{print $2}')

if [ ! -f "{{.OUTPUT_FILE}}" ]; then
echo "[remote:curl] output file does not exist: {{.OUTPUT_FILE}}" >&2
exit 1
fi

actual_sha="$(openssl dgst -sha256 "{{.OUTPUT_FILE}}" | awk '{print $2}')" || {
echo "[remote:curl] failed to compute sha256 for {{.OUTPUT_FILE}}" >&2
exit 1
}

if [ -z "${actual_sha}" ]; then
echo "[remote:curl] sha256 command returned empty output for {{.OUTPUT_FILE}}" >&2
exit 1
fi

if [ "{{.FILE_SHA256}}" != "${actual_sha}" ]; then
echo "[remote:curl] sha256 mismatch for {{.OUTPUT_FILE}}" >&2
echo " expected: {{.FILE_SHA256}}" >&2
echo " actual: ${actual_sha}" >&2
exit 1
fi

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