From: David Galloway Date: Fri, 10 Jul 2026 18:17:36 +0000 (-0400) Subject: setup_chacractl: fail when shaman has no healthy chacra nodes X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=59c0c03cf17d7aef24a9168dadff9b06461fdc68;p=ceph-build.git setup_chacractl: fail when shaman has no healthy chacra nodes shaman's /api/nodes/next/ answers 404 with an HTML error page when it has no healthy chacra node to allocate; without -f, curl captured that page and setup_chacractl.sh wrote it into ~/.chacractl as the url. Fail the curl instead. Also run setup_chacractl.sh from the chacra upload stage rather than the check stage: the existence check asks shaman now, so chacra being unhealthy only fails cells that actually need to upload to chacra (the upload stage's environment{} provides the credentials). Signed-off-by: David Galloway --- diff --git a/ceph-dev-pipeline/build/Jenkinsfile b/ceph-dev-pipeline/build/Jenkinsfile index b5a537aa8..f034bb89d 100644 --- a/ceph-dev-pipeline/build/Jenkinsfile +++ b/ceph-dev-pipeline/build/Jenkinsfile @@ -241,15 +241,6 @@ def doCopyArtifactsStage() { // Stage 5.1 (check for chacra packages): ask shaman whether a chacra repo is ready for this build (and skip compilation if so, unless FORCE). def doCheckForChacraPackagesStage() { - withCredentials([ - string(credentialsId: "chacractl-key", variable: "CHACRACTL_KEY"), - string(credentialsId: "shaman-api-key", variable: "SHAMAN_API_KEY") - ]) { - // Configures ~/.chacractl for the upload stage later in this cell. - sh """#!/bin/bash -ex - ./scripts/setup_chacractl.sh - """ - } def os = get_os_info(env.DIST) // Uploads go to whichever chacra node shaman's /api/nodes/next/ hands out, // so `chacractl exists` against a freshly allocated node only succeeds when @@ -538,6 +529,14 @@ def withUploadEnv(Closure body) { // Stage 8.1 (upload packages to Chacra): build ceph-release RPM (rpm distros) and upload packages to Chacra. def doUploadChacraStage() { def os = get_os_info(env.DIST) + // Point ~/.chacractl at the chacra node shaman allocates for uploads. + // Runs here rather than in the check stage (which asks shaman, not + // chacra) so that shaman having no healthy chacra nodes only fails + // builds that actually need to upload to chacra. CHACRACTL_KEY and + // SHAMAN_API_KEY come from the "upload packages" stage environment{}. + sh """#!/bin/bash -ex + ./scripts/setup_chacractl.sh + """ def chacra_url = sh( script: "grep '^url' ~/.chacractl", returnStdout: true, ).trim().split('"')[1].trim().replaceAll(/\/+$/, '') diff --git a/scripts/setup_chacractl.sh b/scripts/setup_chacractl.sh index 04f03155c..64513ae4a 100755 --- a/scripts/setup_chacractl.sh +++ b/scripts/setup_chacractl.sh @@ -4,7 +4,10 @@ ~/.local/bin/uv tool install chacractl if [ -z "$chacra_url" ]; then - chacra_url=$(curl -u "$SHAMAN_API_USER:$SHAMAN_API_KEY" https://shaman.ceph.com/api/nodes/next/) + # -f: shaman answers 404 ("no healthy chacra nodes available") when it has + # no node to allocate; fail here instead of writing the HTML error page + # into ~/.chacractl. + chacra_url=$(curl -fs -u "$SHAMAN_API_USER:$SHAMAN_API_KEY" https://shaman.ceph.com/api/nodes/next/) fi cat > $HOME/.chacractl << EOF url = "$chacra_url"