ci(release): allow for the index rebuild before checking the upload
CI / check (push) Successful in 4m33s
CI / check (push) Successful in 4m33s
This commit is contained in:
2 files changed
+22
-7
No files matched your search
@@ -224,15 +224,29 @@ jobs:
|
||||
# CDN, so a HEAD is not enough: the index and the file can disagree
|
||||
# for as long as the CDN caches the previous build under this name,
|
||||
# and the checksum is exactly what pacman verifies before installing.
|
||||
# A freshly accepted upload is not routable instantly, so an absent
|
||||
# file is retried before giving up; different bytes are a real
|
||||
# mismatch and fail at once, since that is what breaks pacman.
|
||||
url="https://repo.laxacube.ch/x86_64/$PACKAGE_NAME"
|
||||
expected="$(cut -d' ' -f1 "$PACKAGE_FILE.sha256")"
|
||||
for _ in 1 2 3 4 5 6; do
|
||||
if [ "$(curl -fsSL "$url" | sha256sum | cut -d' ' -f1)" = "$expected" ]; then
|
||||
echo "published $url"
|
||||
exit 0
|
||||
code=000
|
||||
for _ in $(seq 1 24); do
|
||||
code="$(curl -sS -o "$RUNNER_TEMP/served.pkg" -w '%{http_code}' "$url" || true)"
|
||||
if [ "$code" = 200 ]; then
|
||||
served="$(sha256sum "$RUNNER_TEMP/served.pkg" | cut -d' ' -f1)"
|
||||
if [ "$served" = "$expected" ]; then
|
||||
echo "published $url"
|
||||
exit 0
|
||||
fi
|
||||
echo "::error::$url serves sha256 $served instead of $expected"
|
||||
echo "::error::the CDN is still caching another build under this name: purge it before re-running"
|
||||
exit 1
|
||||
fi
|
||||
sleep 5
|
||||
done
|
||||
echo "::error::$url does not serve this build (expected sha256 $expected)"
|
||||
echo "::error::the CDN is probably still caching an older file under this name: purge it before re-running"
|
||||
if [ "$code" = 404 ]; then
|
||||
echo "::warning::$url is not visible yet; the repository accepted the upload, pacman will see it once the index is rebuilt"
|
||||
exit 0
|
||||
fi
|
||||
echo "::error::$url answered HTTP $code after the upload"
|
||||
exit 1
|
||||
Reference in new issue
Block a user