From: David Galloway Date: Fri, 10 Jul 2026 20:58:01 +0000 (-0400) Subject: builder-reimage: add CEPH_BUILD_BRANCH parameter X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=32ae4c916236d1ebabe6bb5655df3d6405b6a737;p=ceph-build.git builder-reimage: add CEPH_BUILD_BRANCH parameter 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 --- diff --git a/builder-reimage/build/Jenkinsfile b/builder-reimage/build/Jenkinsfile index 9075899ee..0bc63bbc2 100644 --- a/builder-reimage/build/Jenkinsfile +++ b/builder-reimage/build/Jenkinsfile @@ -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" \ diff --git a/builder-reimage/build/prepare_env.sh b/builder-reimage/build/prepare_env.sh index c0ab2b2b2..02efbf1c7 100644 --- a/builder-reimage/build/prepare_env.sh +++ b/builder-reimage/build/prepare_env.sh @@ -3,7 +3,7 @@ set -euo pipefail # prepare_env.sh # Usage: -# prepare_env.sh +# prepare_env.sh [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 diff --git a/builder-reimage/config/definitions/builder-reimage.yml b/builder-reimage/config/definitions/builder-reimage.yml index c07333831..b77524d9e 100644 --- a/builder-reimage/config/definitions/builder-reimage.yml +++ b/builder-reimage/config/definitions/builder-reimage.yml @@ -29,18 +29,16 @@ 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