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 {
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.
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" \
# 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"
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%%.*}"
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
}
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
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