fix(ci): use bare shell vars in existing-version check (crow ${VAR} substitution)
All checks were successful
ci/crow/cron/build/6 Pipeline was successful
ci/crow/cron/build/10 Pipeline was successful
ci/crow/cron/build/16 Pipeline was successful
ci/crow/cron/build/8 Pipeline was successful
ci/crow/cron/build/5 Pipeline was successful
ci/crow/cron/build/18 Pipeline was successful
ci/crow/cron/build/14 Pipeline was successful
ci/crow/cron/build/17 Pipeline was successful
ci/crow/cron/build/9 Pipeline was successful
ci/crow/cron/build/13 Pipeline was successful
ci/crow/cron/build/4 Pipeline was successful
ci/crow/cron/build/15 Pipeline was successful
ci/crow/cron/build/7 Pipeline was successful
ci/crow/cron/build/3 Pipeline was successful
ci/crow/cron/build/2 Pipeline was successful
ci/crow/cron/build/12 Pipeline was successful
ci/crow/cron/build/11 Pipeline was successful
ci/crow/cron/build/1 Pipeline was successful

The merged HEAD-probe check still rebuilt everything: crow runs its own
${VAR} substitution over the commands before the shell executes, so the
shell variables ${BASE} and ${VERSION} were blanked to empty (only matrix
vars resolve at that stage). Every probed URL was therefore malformed and
returned non-200, leaving r-versions-existing.txt empty.

Use bare $name for shell variables and build the filename with printf, which
avoids the ${VERSION}_1 brace requirement entirely. Matrix vars (${PLATFORM},
${PLATFORM_ID}, ${ARCH_ID}) keep braces since crow resolves those correctly.
Verified URL construction against the live bucket for apk, deb and rpm.
This commit is contained in:
Patrick Schratz 2026-06-29 14:15:55 +02:00
commit 8eacc0ab47
Signed by: pat-s
GPG key ID: 3C6318841EF78925

View file

@ -168,16 +168,18 @@ steps:
# with an anonymous HEAD instead of listing the bucket. The filename mirrors # with an anonymous HEAD instead of listing the bucket. The filename mirrors
# what nfpm produces in builder/package.${PLATFORM} (version/release pinned # what nfpm produces in builder/package.${PLATFORM} (version/release pinned
# to 1): r-<ver>_1_<arch>.{apk,deb} for alpine/ubuntu, R-<ver>-1-1.<arch>.rpm # to 1): r-<ver>_1_<arch>.{apk,deb} for alpine/ubuntu, R-<ver>-1-1.<arch>.rpm
# for el*. # for el*. Shell variables must use bare $name, not ${name}: crow performs
# its own ${VAR} substitution on these commands before the shell runs, so
# ${VAR} for a shell var would be blanked out (only matrix vars resolve there).
case "${PLATFORM}" in case "${PLATFORM}" in
alpine-*) FILE="r-VER_1_${ARCH_ID}.apk" ;; alpine-*) FMT="r-%s_1_%s.apk" ;;
ubuntu-*) FILE="r-VER_1_${ARCH_ID}.deb" ;; ubuntu-*) FMT="r-%s_1_%s.deb" ;;
*) FILE="R-VER-1-1.${ARCH_ID}.rpm" ;; *) FMT="R-%s-1-1.%s.rpm" ;;
esac esac
BASE="https://s3.eu-central-003.backblazeb2.com/devxy-r-builds/${PLATFORM_ID}" BASE="https://s3.eu-central-003.backblazeb2.com/devxy-r-builds/${PLATFORM_ID}"
: > r-versions-existing.txt : > r-versions-existing.txt
for VERSION in $(cat r-versions-to-build.txt); do for VERSION in $(cat r-versions-to-build.txt); do
URL="${BASE}/$(echo "$FILE" | sed "s/VER/${VERSION}/")" URL="$BASE/$(printf "$FMT" "$VERSION" "${ARCH_ID}")"
if [ "$(curl -s -o /dev/null -w '%{http_code}' -I "$URL")" = "200" ]; then if [ "$(curl -s -o /dev/null -w '%{http_code}' -I "$URL")" = "200" ]; then
echo "$VERSION" >> r-versions-existing.txt echo "$VERSION" >> r-versions-existing.txt
fi fi