From 7c3cfc50e994db643fd7391aacdbd27b77bbd2a2 Mon Sep 17 00:00:00 2001 From: Ryan Hughes Date: Thu, 27 Aug 2026 01:06:25 -0400 Subject: [PATCH] Fix silent notifications and stop stale checkouts queueing rebuild loops MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two failures from the first live run: notify_basecamp declared 'local BASECAMP_CHATBOT_URL' and then called release_chatbot_url, whose fallback reads that same global — bash locals are visible to called functions, so the fallback saw the empty local and every notification silently went nowhere for anyone with only the legacy variable set. The local is now named 'url'. check-versions compared PKGBUILD and published versions with !=, so a checkout BEHIND the channel queued a rebuild of an older version every cycle: the builder produced it and promotion refused it, because that exact filename is already published with different bytes. It now skips (with a warning naming the package) when an artifact for the PKGBUILD's version already exists in the channel, whichever direction the versions differ. --- bin/check-versions | 11 +++++++++++ helpers/basecamp-notifier.sh | 12 ++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/bin/check-versions b/bin/check-versions index ef81e29..0d12005 100755 --- a/bin/check-versions +++ b/bin/check-versions @@ -131,6 +131,17 @@ check_package() { return 1 fi + # Different is not the same as newer. A checkout behind the published state + # — a stale branch, an un-pulled host — otherwise queues a REBUILD OF AN + # OLDER VERSION every cycle: the builder produces it, and promotion refuses + # it because that exact filename is already published with different bytes. + # If the artifact for this version already exists in the channel, there is + # nothing to build regardless of which direction the versions differ. + if compgen -G "$REPO_ROOT/$mirror/$ARCH/${pkg}-${pkgbuild_version}-*.pkg.tar."[!s]* >/dev/null 2>&1; then + print_warning "$pkg $pkgbuild_version is already published — this checkout is behind the channel; not queueing" + return 1 + fi + return 0 } diff --git a/helpers/basecamp-notifier.sh b/helpers/basecamp-notifier.sh index 98470e2..aa8298f 100644 --- a/helpers/basecamp-notifier.sh +++ b/helpers/basecamp-notifier.sh @@ -17,17 +17,21 @@ release_chatbot_url() { notify_basecamp() { local content="$1" - local BASECAMP_CHATBOT_URL - BASECAMP_CHATBOT_URL=$(release_chatbot_url) + # NOT named BASECAMP_CHATBOT_URL: bash locals are visible to called + # functions, so declaring that name here would shadow the global that + # release_chatbot_url falls back to — and every notification would silently + # go nowhere for anyone who has only the legacy variable set. + local url + url=$(release_chatbot_url) - if [[ -z "${BASECAMP_CHATBOT_URL:-}" ]]; then + if [[ -z "$url" ]]; then return 0 fi curl -s -o /dev/null \ -H "Content-Type: application/json" \ -d "$(jq -n --arg content "$content" '{content: $content}')" \ - "$BASECAMP_CHATBOT_URL" 2>/dev/null || true + "$url" 2>/dev/null || true } basecamp_html_escape() {