]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-build.git/commitdiff
builder-reimage: add CEPH_BUILD_BRANCH parameter
authorDavid Galloway <david.galloway@ibm.com>
Fri, 10 Jul 2026 20:58:01 +0000 (16:58 -0400)
committerDavid Galloway <david.galloway@ibm.com>
Fri, 10 Jul 2026 20:58:01 +0000 (16:58 -0400)
Add the same CEPH_BUILD_BRANCH functionality ceph-dev-pipeline has: a
string parameter (default main) wired into the pipeline-scm branch
spec, so the Jenkinsfile and 'checkout scm' contents can be taken from
a ceph-build branch under test.

Unlike ceph-dev-pipeline, this job also clones ceph-build at runtime
via prepare_env.sh (ansible_runner.sh runs playbooks from
repos/main/ansible), so pass the branch through as a new optional
seventh argument and clone that branch. Also fix the usage comment,
which had the main/ansible repo argument order swapped.

Drop the top-level scm block from the JJB definition: jenkins-jobs
discards it for pipeline project-type jobs (verified the generated XML
is identical with and without it), so it was dead config.

Signed-off-by: David Galloway <david.galloway@ibm.com>
builder-reimage/build/Jenkinsfile
builder-reimage/build/prepare_env.sh
builder-reimage/config/definitions/builder-reimage.yml

index 9075899ee257c751ecbf5cd72048988f7c8e874d..0bc63bbc2b3e5ca45502b6864192cdae723d9560 100644 (file)
@@ -14,6 +14,11 @@ pipeline {
             defaultValue: '',
             description: 'node1 or node1,node2'
         )
+        string(
+            name: 'CEPH_BUILD_BRANCH',
+            defaultValue: 'main',
+            description: 'Use the Jenkinsfile and scripts from this ceph-build branch'
+        )
     }
 
     stages {
@@ -66,7 +71,8 @@ pipeline {
                                                     true \
                                                     git@github.com:ceph/ceph-build.git \
                                                     git@github.com:ceph/ceph-cm-ansible.git \
-                                                    git@github.com:ceph/ceph-sepia-secrets.git
+                                                    git@github.com:ceph/ceph-sepia-secrets.git \
+                                                    "${params.CEPH_BUILD_BRANCH}"
                                                 
                                                 # Temporary test helper to use a non-default secrets repo branch.
                                                 # Uncomment the lines below only for branch-based inventory validation.
@@ -232,7 +238,8 @@ pipeline {
                                                 bash prepare_env.sh "\$TARGET_FQDN" "\$WORK_DIR" true \
                                                   git@github.com:ceph/ceph-build.git \
                                                   git@github.com:ceph/ceph-cm-ansible.git \
-                                                  git@github.com:ceph/ceph-sepia-secrets.git
+                                                  git@github.com:ceph/ceph-sepia-secrets.git \
+                                                  "${params.CEPH_BUILD_BRANCH}"
 
                                                 bash ansible_runner.sh \
                                                   "\$TARGET_FQDN" \
index c0ab2b2b2141ce2b1765a34f1377340d2f7e8b5f..02efbf1c702241b56dadc6afc6cf2356b208484d 100644 (file)
@@ -3,7 +3,7 @@ set -euo pipefail
 
 # prepare_env.sh
 # Usage:
-#   prepare_env.sh <target_fqdn> <work_dir> <ssh_available> <ansible_repo> <main_repo> <secrets_repo>
+#   prepare_env.sh <target_fqdn> <work_dir> <ssh_available> <main_repo> <ansible_repo> <secrets_repo> [ceph_build_branch]
 
 TARGET_FQDN="$1"
 WORK_DIR="$2"
@@ -11,6 +11,7 @@ SSH_AVAILABLE="${3:-false}"
 MAIN_REPO="${4:-git@github.com:ceph/ceph-build.git}"
 ANSIBLE_REPO="${5:-git@github.com:ceph/ceph-cm-ansible.git}"
 SECRETS_REPO="${6:-git@github.com:ceph/ceph-sepia-secrets.git}"
+CEPH_BUILD_BRANCH="${7:-main}"
 
 SHORTNAME="${TARGET_FQDN%%.*}"
 
@@ -39,12 +40,13 @@ adjust_url() {
 clone_repo() {
   local url="$1"
   local dir="$2"
+  local branch="${3:-}"
   if [ -d "${dir}/.git" ]; then
     log "Updating existing repo ${dir}"
     (cd "${dir}" && git fetch --all --prune)
   else
-    log "Cloning ${url} -> ${dir}"
-    git clone --depth 1 "${url}" "${dir}"
+    log "Cloning ${url}${branch:+ (branch ${branch})} -> ${dir}"
+    git clone --depth 1 ${branch:+--branch "${branch}"} "${url}" "${dir}"
   fi
 }
 
@@ -53,7 +55,7 @@ MAIN_URL=$(adjust_url "${MAIN_REPO}")
 SECRETS_URL=$(adjust_url "${SECRETS_REPO}")
 
 clone_repo "${ANSIBLE_URL}" "${ANSIBLE_DIR}"
-clone_repo "${MAIN_URL}" "${MAIN_DIR}"
+clone_repo "${MAIN_URL}" "${MAIN_DIR}" "${CEPH_BUILD_BRANCH}"
 clone_repo "${SECRETS_URL}" "${SECRETS_DIR}"
 
 # Ensure venv exists
index c07333831c3a58b4b85c4a610c9af9ce9a4eb42a..b77524d9e51b71c3b7b9797ccd7c939d15bd81e0 100644 (file)
           default: false
           description: "Skip reimage and only run post-reimage tasks"
 
-    scm:
-      - git:
-          url: https://github.com/ceph/ceph-build.git
-          branches:
-            - main
-          clean: true
+      - string:
+          name: CEPH_BUILD_BRANCH
+          default: main
+          description: "Use the Jenkinsfile and scripts from this ceph-build branch"
 
     pipeline-scm:
       scm:
         - git:
             url: https://github.com/ceph/ceph-build.git
             branches:
-              - main
+              - ${{CEPH_BUILD_BRANCH}}
       script-path: builder-reimage/build/Jenkinsfile
       lightweight-checkout: true