Fix silent notifications and stop stale checkouts queueing rebuild loops
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.
This commit is contained in:
@@ -131,6 +131,17 @@ check_package() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
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
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,17 +17,21 @@ release_chatbot_url() {
|
|||||||
|
|
||||||
notify_basecamp() {
|
notify_basecamp() {
|
||||||
local content="$1"
|
local content="$1"
|
||||||
local BASECAMP_CHATBOT_URL
|
# NOT named BASECAMP_CHATBOT_URL: bash locals are visible to called
|
||||||
BASECAMP_CHATBOT_URL=$(release_chatbot_url)
|
# 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
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
curl -s -o /dev/null \
|
curl -s -o /dev/null \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d "$(jq -n --arg content "$content" '{content: $content}')" \
|
-d "$(jq -n --arg content "$content" '{content: $content}')" \
|
||||||
"$BASECAMP_CHATBOT_URL" 2>/dev/null || true
|
"$url" 2>/dev/null || true
|
||||||
}
|
}
|
||||||
|
|
||||||
basecamp_html_escape() {
|
basecamp_html_escape() {
|
||||||
|
|||||||
Reference in New Issue
Block a user