fix: retry and validate CI source archives before extraction
This commit is contained in:
@@ -17,9 +17,21 @@ jobs:
|
||||
COMMIT_SHA: ${{ github.sha }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
curl -fLsS -H "Authorization: token ${GITEA_TOKEN}" \
|
||||
"https://git.sundynix.cn/${REPOSITORY}/archive/${COMMIT_SHA}.tar.gz" \
|
||||
| tar -xz --strip-components=1
|
||||
archive_path="$(mktemp)"
|
||||
trap 'rm -f "$archive_path"' EXIT
|
||||
archive_ready=false
|
||||
for attempt in 1 2 3 4 5; do
|
||||
if curl -fLsS --connect-timeout 10 --max-time 180 --retry 2 --retry-all-errors \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
"https://git.sundynix.cn/${REPOSITORY}/archive/${COMMIT_SHA}.tar.gz" \
|
||||
-o "$archive_path" && tar -tzf "$archive_path" >/dev/null 2>&1; then
|
||||
archive_ready=true
|
||||
break
|
||||
fi
|
||||
sleep "$attempt"
|
||||
done
|
||||
test "$archive_ready" = true
|
||||
tar -xzf "$archive_path" --strip-components=1
|
||||
- name: Install SSH tools
|
||||
run: |
|
||||
set -eu
|
||||
@@ -48,9 +60,21 @@ jobs:
|
||||
COMMIT_SHA: ${{ github.sha }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
curl -fLsS -H "Authorization: token ${GITEA_TOKEN}" \
|
||||
"https://git.sundynix.cn/${REPOSITORY}/archive/${COMMIT_SHA}.tar.gz" \
|
||||
| tar -xz --strip-components=1
|
||||
archive_path="$(mktemp)"
|
||||
trap 'rm -f "$archive_path"' EXIT
|
||||
archive_ready=false
|
||||
for attempt in 1 2 3 4 5; do
|
||||
if curl -fLsS --connect-timeout 10 --max-time 180 --retry 2 --retry-all-errors \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
"https://git.sundynix.cn/${REPOSITORY}/archive/${COMMIT_SHA}.tar.gz" \
|
||||
-o "$archive_path" && tar -tzf "$archive_path" >/dev/null 2>&1; then
|
||||
archive_ready=true
|
||||
break
|
||||
fi
|
||||
sleep "$attempt"
|
||||
done
|
||||
test "$archive_ready" = true
|
||||
tar -xzf "$archive_path" --strip-components=1
|
||||
- name: Install SSH tools
|
||||
run: |
|
||||
set -eu
|
||||
|
||||
Reference in New Issue
Block a user