pipeline {
agent any
+ // environment {
+ // release builds must use ceph-releases; ignore any user-provided value
+ // CEPH_REPO = "${ params.RELEASE_BUILD?.trim() ? 'git@github.com:ceph/ceph-releases.git' : (params.CEPH_REPO ?: 'https://github.com/ceph/ceph') }"
+ // CEPH_REPO_LOCKED = "${ params.RELEASE_BUILD?.trim() ? 'true' : 'false' }"
+ // }
stages {
+ stage('create ceph release tag') {
+ when {
+ expression { return params.RELEASE_BUILD?.trim() } // only run if defined & true
+ }
+ steps {
+ script {
+ def createTagJob = build(
+ job: 'preserve-ceph-tag-dgalloway',
+ parameters: [
+ string(name: 'VERSION', value: env.VERSION ?: ''),
+ string(name: 'BRANCH', value: env.BRANCH ?: ''),
+ string(name: 'FORCE_VERSION', value: env.FORCE_VERSION ?: ''),
+ string(name: 'RELEASE_TYPE', value: env.RELEASE_TYPE ?: ''),
+ string(name: 'RELEASE_BUILD', value: env.RELEASE_BUILD ?: ''),
+ string(name: 'TAG', value: env.TAG ?: ''),
+ string(name: 'TAG_PHASE', value: 'create')
+ ],
+ )
+ env.CEPH_TAG_CREATE_JOB_ID = createTagJob.getNumber()
+ println "CEPH_TAG_CREATE_JOB_ID=${env.CEPH_TAG_CREATE_JOB_ID}"
+ env.CEPH_TAG_CREATE_JOB_URL = new URI([env.JENKINS_URL, "job", "preserve-ceph-tag-dgalloway", env.CEPH_TAG_CREATE_JOB_ID].join("/")).normalize()
+ println "${env.SETUP_BUILD_URL}"
+ }
+ }
+ }
stage("source distribution") {
steps {
script {
// Below are just for ceph-source-dist
string(name: "CEPH_REPO", value: env.CEPH_REPO),
string(name: "CEPH_BUILD_BRANCH", value: env.CEPH_BUILD_BRANCH),
+ // Below are only for actual releases
+ string(name: 'RELEASE_TYPE', value: env.RELEASE_TYPE ?: ''),
+ string(name: 'RELEASE_BUILD', value: env.RELEASE_BUILD ?: ''),
+ string(name: 'VERSION', value: env.VERSION ?: '')
]
)
env.SETUP_BUILD_ID = setup_build.getNumber()
stage("node") {
steps {
script {
+ sh "env"
build_matrix["${DIST}_${ARCH}"] = env.CI_COMPILE.toBoolean()
sh "hostname -f"
def node_shortname = env.NODE_NAME.split('\\+')[-1]
)
}
script {
+ sh "env"
def sha1_props = readProperties file: "${WORKSPACE}/dist/sha1"
env.SHA1 = sha1_props.SHA1
println "SHA1=${env.SHA1}"
sha1_ui_value = "<a href=\"${commit_url}\">${env.SHA1}</a>"
}
def shaman_url = "https://shaman.ceph.com/builds/ceph/${env.BRANCH}/${env.SHA1}"
+ script {
+ def props = readProperties file: "${WORKSPACE}/dist/other_envvars"
+ for (p in props) {
+ env."${p.key}" = p.value
+ }
+ }
def build_description = """\
BRANCH=${branch_ui_value}<br />
SHA1=${sha1_ui_value}<br />
}
sh "sha256sum dist/*"
sh "cat dist/sha1 dist/version"
- script {
- def props = readProperties file: "${WORKSPACE}/dist/other_envvars"
- for (p in props) {
- env."${p.key}" = p.value
- }
- }
+
sh '''#!/bin/bash
set -ex
cd dist
}
steps {
script {
+ if (env.RELEASE_BUILD?.trim()) {
+ def chacra_url = "https://chacra.ceph.com/"
+ }
sh './scripts/setup_chacractl.sh'
def chacra_url = sh(
script: '''grep url ~/.chacractl | cut -d'"' -f2''',
- job:
- name: ceph-dev-pipeline
- description: ceph-dev-pipeline
+ name: preserve-ceph-dev-pipeline-dgalloway
+ description: preserve-ceph-dev-pipeline-dgalloway
project-type: pipeline
quiet-period: 1
concurrent: true
- choice:
name: SETUP_JOB
choices:
- - ceph-source-dist
+ - preserve-ceph-source-dist-dgalloway
- ceph-dev-new-setup
- string:
name: CEPH_BUILD_BRANCH
description: "Use the Jenkinsfile from this ceph-build branch"
- default: main
+ default: release-with-pipeline
wrappers:
- inject-passwords:
pipeline {
agent {
- label "gigantic"
+ label "gigantic&&!arm64"
}
stages {
stage("repository") {
steps {
dir("ceph") {
- checkout scmGit(
- branches: [[name: env.BRANCH]],
- userRemoteConfigs: [[
- url: env.CEPH_REPO,
- credentialsId: 'jenkins-build'
- ]],
- extensions: [
- [$class: 'CleanBeforeCheckout'],
- [
- $class: 'CloneOption',
- shallow: true,
- depth: 100,
- timeout: 90
+ script {
+ // Choose repo + ref based on RELEASE_BUILD bool
+ // These are intentionally not definable by parent jobs for security
+ def repoUrl = params.RELEASE_BUILD ? 'git@github.com:ceph/ceph-releases.git' : env.CEPH_REPO
+ def refToCheckout = params.RELEASE_BUILD ? "v${params.VERSION}" : env.BRANCH
+
+ // Make the chosen repo visible to later stages if needed
+ env.CEPH_REPO = repoUrl
+
+ checkout scmGit(
+ branches: [[name: refToCheckout]],
+ userRemoteConfigs: [[
+ url: repoUrl,
+ credentialsId: 'jenkins-build'
+ ]],
+ extensions: [
+ [$class: 'CleanBeforeCheckout'],
+ [
+ $class: 'CloneOption',
+ shallow: true,
+ depth: 100,
+ timeout: 90
+ ],
],
- ],
- )
+ )
+ }
script {
- sh 'git fetch --tags https://github.com/ceph/ceph.git'
+ if (!params.RELEASE_BUILD?.toBoolean()) {
+ sh 'git fetch --tags https://github.com/ceph/ceph.git'
+ }
}
}
}
if [ "$ceph_version_tarball" != "" ]; then break; fi
done
echo tarball vers $ceph_version_tarball
-
+ ## TODO: CMAKE ARGS FROM ceph-setup?
ln ceph.spec dist/
ln ceph-$ceph_version_tarball.$extension dist/
echo "SHA1=$(git rev-parse HEAD)" > dist/sha1
- echo "BRANCH=${BRANCH}" > dist/branch
+
+ if [ "${RELEASE_BUILD:-}" = "true" ]; then
+ echo "CEPH_REPO=https://github.com/ceph/ceph-releases" > dist/other_envvars
+ echo "RELEASE_BUILD=true" >> dist/other_envvars
+ echo "chacra_url=https://chacra.ceph.com/" >> dist/other_envvars
+ echo "BRANCH=${BRANCH}-release" > dist/branch
+ else
+ echo "BRANCH=${BRANCH}" > dist/branch
+ fi
mv dist ..
'''
- job:
- name: ceph-source-dist
+ name: preserve-ceph-source-dist-dgalloway
project-type: pipeline
concurrent: true
pipeline-scm:
artifact-days-to-keep: -1
artifact-num-to-keep: 50
- copyartifact:
- projects: ceph-dev-pipeline,ceph-dev,ceph-dev-build,ceph-dev-new,ceph-dev-new-build
+ projects: ceph-dev-pipeline,ceph-dev,ceph-dev-build,ceph-dev-new,ceph-dev-new-build,preserve-ceph-dev-pipeline-dgalloway
parameters:
- choice:
# run ansible to do all the tagging and release specifying
# a local connection and 'localhost' as the host where to execute
cd "$WORKSPACE/ceph-build/ansible/"
- $VENV/ansible-playbook -i "localhost," -c local release.yml --extra-vars="stage=push version=$VERSION branch=$BRANCH force_version=$FORCE_VERSION release=$RELEASE_TYPE tag=$TAG project=ceph token=$GITHUB_TOKEN"
+
+ $VENV/ansible-playbook -i "localhost," -c local release.yml --extra-vars="stage=$TAG_PHASE version=$VERSION branch=$BRANCH force_version=$FORCE_VERSION release=$RELEASE_TYPE tag=$TAG project=ceph token=$GITHUB_TOKEN"
fi
- job:
- name: ceph-tag
- node: bionic
+ name: preserve-ceph-tag-dgalloway
+ node: 'bionic&&!arm64'
description: "This job checks out the version commit previously pushed to ceph-releases.git and pushes it to ceph.git."
display-name: 'ceph-tag'
block-downstream: false
--- /dev/null
+#!/bin/bash
+
+set -ex
+
+# the following two methods exist in scripts/build_utils.sh
+pkgs=( "ansible" )
+TEMPVENV=$(create_venv_dir)
+VENV=${TEMPVENV}/bin
+install_python_packages $TEMPVENV "pkgs[@]"
+
+# remove "-release" from $BRANCH variable in case it was accidentally passed in the Jenkins UI
+BRANCH=${BRANCH//-release/}
+
+# run ansible to do all the tagging and release specifying
+# a local connection and 'localhost' as the host where to execute
+cd "$WORKSPACE/ceph-build/ansible/"
+$VENV/ansible-playbook -i "localhost," -c local release.yml -vvv --extra-vars="stage=create version=$VERSION branch=$BRANCH force_version=$FORCE_VERSION release=$RELEASE_TYPE tag=$TAG throwaway=$THROWAWAY project=ceph"
- job:
- name: ceph
+ name: preserve-ceph-release-dgalloway
description: 'This is the main ceph build task which uses chacra.ceph.com.'
project-type: multijob
defaults: global
- display-name: 'ceph'
+ display-name: 'preserve-ceph-release-dgalloway'
block-downstream: false
block-upstream: false
concurrent: true
description: "The git branch (or tag) to build (e.g., pacific) DO NOT INCLUDE '-release'"
default: main
+ - string:
+ name: VERSION
+ description: "The version for release, e.g. 0.94.4"
+
- bool:
name: TEST
description: "
If this is checked, then the binaries will be built and pushed to chacra even if they already exist in chacra."
- - string:
- name: VERSION
- description: "The version for release, e.g. 0.94.4"
-
- choice:
name: RELEASE_TYPE
description: "
- HOTFIX
- SECURITY
- - string:
- name: CEPH_BUILD_VIRTUALENV
- description: "Base parent path for virtualenv locations, set to avoid issues with extremely long paths that are incompatible with tools like pip. Defaults to '/tmp/' (note the trailing slash, which is required)."
- default: "/tmp/"
-
- string:
name: DISTROS
description: "A list of distros to build for. Available options are: centos9, centos8, centos7, centos6, noble, jammy, focal, bionic, xenial, trusty, precise, wheezy, jessie, buster, bullseye, bookworm"
- default: "noble jammy focal centos8 centos9 bookworm"
+ default: "noble jammy centos8 centos9 bookworm"
- string:
name: ARCHS
description: "A list of architectures to build for. Available options are: x86_64, and arm64"
default: "x86_64 arm64"
- - string:
- name: CONTAINER_REPO_HOSTNAME
- description: "Name of (prerelease) container repo server (i.e. 'quay.ceph.io')"
- default: "quay.ceph.io"
-
- - string:
- name: CONTAINER_REPO_ORGANIZATION
- description: "Name of (prerelease) container repo organization (i.e. 'ceph'). Container build script will add prerelease-<arch>"
- default: "ceph"
-
- builders:
- - multijob:
- name: 'ceph setup phase'
- condition: SUCCESSFUL
- projects:
- - name: ceph-setup
- current-parameters: true
- exposed-scm: false
- - copyartifact:
- project: ceph-setup
- filter: ceph-build/ansible/ceph/dist/sha1
- which-build: multijob-build
- - inject:
- properties-file: ${{WORKSPACE}}/ceph-build/ansible/ceph/dist/sha1
- - multijob:
- name: 'ceph build phase'
- condition: SUCCESSFUL
- projects:
- - name: ceph-build
- current-parameters: true
- exposed-scm: false
- - multijob:
- name: 'ceph tag phase'
- condition: SUCCESSFUL
- projects:
- - name: ceph-tag
- current-parameters: true
- exposed-scm: false
+ publishers:
+ - trigger-parameterized-builds:
+ - project: "preserve-ceph-dev-pipeline-dgalloway"
+ condition: SUCCESS
+ trigger-with-no-params: false
+ current-parameters: true
+ predefined-parameters: |
+ FLAVOR=default
+ CI_COMPILE=true
+ CI_CONTAINER=false
+ DWZ=false
+ SCCACHE=false
+ SETUP_JOB=preserve-ceph-source-dist-dgalloway
+ RELEASE_BUILD=true
+ block: true
wrappers:
- - inject-passwords:
- global: true
- mask-password-params: true
- build-name:
- name: "#${{BUILD_NUMBER}} ${{BRANCH}}, ${{SHA1}}"
+ name: "#${{BUILD_NUMBER}} ${{BRANCH}}, ${{VERSION}}"
pipx install uv
~/.local/bin/uv tool install chacractl
-chacra_url=`curl -u $SHAMAN_API_USER:$SHAMAN_API_KEY https://shaman.ceph.com/api/nodes/next/`
+if [ -n "$chacra_url" ]; then
+ chacra_url=$(curl -u "$SHAMAN_API_USER:$SHAMAN_API_KEY" https://shaman.ceph.com/api/nodes/next/)
+fi
cat > $HOME/.chacractl << EOF
url = "$chacra_url"
user = "$CHACRACTL_USER"