]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-build.git/commitdiff
setup_chacractl: fail when shaman has no healthy chacra nodes
authorDavid Galloway <david.galloway@ibm.com>
Fri, 10 Jul 2026 18:17:36 +0000 (14:17 -0400)
committerDavid Galloway <david.galloway@ibm.com>
Fri, 10 Jul 2026 19:28:12 +0000 (15:28 -0400)
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 <david.galloway@ibm.com>
ceph-dev-pipeline/build/Jenkinsfile
scripts/setup_chacractl.sh

index b5a537aa81fd01afacab32601f6f09f154aeb1db..f034bb89df7355f643ba091228f075189c58d1f1 100644 (file)
@@ -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(/\/+$/, '')
index 04f03155cd48489595fe53728c23b872beddce8b..64513ae4a573e0fd95227167d8b78720055df067 100755 (executable)
@@ -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"