Skip to content

Commit ff4754a

Browse files
prontclaude
andauthored
chore(ci): make nightly S3 verify resilient to CDN staleness (#25259)
* chore(ci): remove dead nightly artifact-redirect loop The loop referenced an undefined $i (copy-paste from the release branch where $i iterates over version tags). Under set -u the subshell errored, the for loop received empty input, and the body never ran — so this has been a no-op since it was added. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore(ci): retry verify_artifact on CDN cache staleness packages.timber.io is fronted by a CDN; after `aws s3 rm --recursive` + `cp --recursive` on nightly/latest, the edge can keep serving stale bytes for longer than the existing 30s VERIFY_TIMEOUT, failing `cmp` and the whole job. wget's --retry-on-http-error=404 only retries 404s, not a 200 with stale content. Wrap the compare in an exponential-backoff retry loop (1, 2, 4, 8, 16, 32s; 7 attempts, ~63s of total sleep) so a transient stale-cache hit no longer fails the release. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent a843435 commit ff4754a

1 file changed

Lines changed: 17 additions & 10 deletions

File tree

scripts/release-s3.sh

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,27 @@ ls "$td_nightly"
3636
#
3737
# A helper function for verifying a published artifact.
3838
#
39+
# Retries a content mismatch as well as a 404, since packages.timber.io is
40+
# fronted by a CDN and an object we just overwrote via `aws s3 rm` + `cp` can
41+
# serve stale bytes at the edge for a while.
3942
verify_artifact() {
4043
local URL="$1"
4144
local FILENAME="$2"
45+
local attempts=7
46+
local delay=1
4247
echo "Verifying $URL"
43-
cmp <(wget -qO- --retry-on-http-error=404 --wait 10 --tries "$VERIFY_RETRIES" "$URL") "$FILENAME"
48+
for ((attempt = 1; attempt <= attempts; attempt++)); do
49+
if cmp <(wget -qO- --retry-on-http-error=404 --wait 10 --tries "$VERIFY_RETRIES" "$URL") "$FILENAME"; then
50+
return 0
51+
fi
52+
if (( attempt < attempts )); then
53+
echo "Attempt $attempt/$attempts did not match (likely stale CDN cache); retrying in ${delay}s"
54+
sleep "$delay"
55+
delay=$((delay * 2))
56+
fi
57+
done
58+
echo "Verification of $URL failed after $attempts attempts"
59+
return 1
4460
}
4561

4662
#
@@ -59,15 +75,6 @@ if [[ "$CHANNEL" == "nightly" ]]; then
5975
aws s3 cp "$td_nightly" "s3://packages.timber.io/vector/nightly/latest" --recursive --sse --acl public-read
6076
echo "Uploaded archives"
6177

62-
echo "Redirecting old artifact names"
63-
for file in $(aws s3api list-objects-v2 --bucket packages.timber.io --prefix "vector/$i/" --query 'Contents[*].Key' --output text | tr "\t" "\n" | grep '\-nightly'); do
64-
file=$(basename "$file")
65-
# vector-nightly-amd64.deb -> vector-amd64.deb
66-
echo -n "" | aws s3 cp - "s3://packages.timber.io/vector/nightly/$DATE/${file/-nightly/}" --website-redirect "/vector/nightly/$DATE/$file" --acl public-read
67-
echo -n "" | aws s3 cp - "s3://packages.timber.io/vector/nightly/latest/${file/-nightly/}" --website-redirect "/vector/nightly/latest/$file" --acl public-read
68-
done
69-
echo "Redirected old artifact names"
70-
7178
# Verify that the files exist and can be downloaded
7279
echo "Waiting for $VERIFY_TIMEOUT seconds before running the verifications"
7380
sleep "$VERIFY_TIMEOUT"

0 commit comments

Comments
 (0)