From 1da59d5000cac3e18ad67e453864831381a99d7d Mon Sep 17 00:00:00 2001 From: David Galloway Date: Wed, 20 Aug 2025 17:31:58 -0400 Subject: [PATCH] ceph-release-pipeline: Add job Signed-off-by: David Galloway --- ceph-release-pipeline/build/Jenkinsfile | 101 ++++++++++++++++++ .../definitions/ceph-release-pipeline.yml | 97 +++++++++++++++++ 2 files changed, 198 insertions(+) create mode 100644 ceph-release-pipeline/build/Jenkinsfile create mode 100644 ceph-release-pipeline/config/definitions/ceph-release-pipeline.yml diff --git a/ceph-release-pipeline/build/Jenkinsfile b/ceph-release-pipeline/build/Jenkinsfile new file mode 100644 index 00000000..9af3331f --- /dev/null +++ b/ceph-release-pipeline/build/Jenkinsfile @@ -0,0 +1,101 @@ +// Global variables to use across stages +def CEPH_TAG_CREATE_JOB_ID, CEPH_TAG_CREATE_JOB_URL +def PACKAGE_BUILD_ID, PACKAGE_BUILD_URL +def CEPH_TAG_PUSH_JOB_ID, CEPH_TAG_PUSH_JOB_URL + +pipeline { + agent any + stages { + stage('create ceph release tag') { + steps { + script { + def createTagJob = build( + job: 'ceph-tag', + parameters: [ + string(name: 'VERSION', value: env.VERSION), + string(name: 'BRANCH', value: env.BRANCH), + booleanParam(name: 'FORCE', value: env.FORCE?.toBoolean()), + booleanParam(name: 'FORCE_VERSION', value: env.FORCE_VERSION?.toBoolean()), + string(name: 'RELEASE_TYPE', value: env.RELEASE_TYPE), + booleanParam(name: 'RELEASE_BUILD', value: true), + booleanParam(name: 'TAG', value: env.TAG?.toBoolean()), + booleanParam(name: "THROWAWAY", value: env.THROWAWAY?.toBoolean()), + string(name: "CEPH_BUILD_BRANCH", value: env.CEPH_BUILD_BRANCH), + string(name: 'TAG_PHASE', value: 'create') + ], + ) + CEPH_TAG_CREATE_JOB_ID = createTagJob.getNumber() + CEPH_TAG_CREATE_JOB_URL = new URI([env.JENKINS_URL, "job", "ceph-tag", CEPH_TAG_CREATE_JOB_ID].join("/")).normalize() + + copyArtifacts projectName: 'ceph-tag', + selector: specific("${CEPH_TAG_CREATE_JOB_ID}"), + filter: 'ceph-build/ansible/ceph/dist/sha1', + target: '.', + flatten: true + + def sha1 = readFile('sha1').trim() + env.SHA1 = sha1 + echo "Downstream returned: ${env.SHA1}" + def build_description = """\ + BRANCH=${env.BRANCH}
+ VERSION=${env.VERSION}
+ SHA1=${env.SHA1}
+ """.stripIndent() + // Note: This requires the 'build-name-setter' plugin + buildDescription build_description + } + } + } + stage("package build") { + steps { + script { + def package_build = build( + job: 'ceph-dev-pipeline', + parameters: [ + // These are in order of the parameters ceph-dev-pipeline takes + string(name: "BRANCH", value: env.BRANCH), + string(name: "SHA1", value: env.SHA1), + string(name: "DISTROS", value: env.DISTROS), + string(name: "ARCHS", value: env.ARCHS), + string(name: "FLAVORS", value: 'default'), + booleanParam(name: "CI_COMPILE", value: true), + booleanParam(name: "THROWAWAY", value: env.THROWAWAY), + booleanParam(name: "FORCE", value: env.FORCE), + string(name: 'FLAVOR', value: 'default'), + // Release containers are built manually from signed packages so we don't need to build them here + booleanParam(name: 'CI_CONTAINER', value: false), + booleanParam(name: 'DWZ', value: true), + booleanParam(name: 'SCCACHE', value: false), + string(name: "CEPH_BUILD_BRANCH", value: env.CEPH_BUILD_BRANCH), + string(name: 'RELEASE_TYPE', value: env.RELEASE_TYPE), + booleanParam(name: 'RELEASE_BUILD', value: true), + string(name: 'VERSION', value: env.VERSION) + ] + ) + PACKAGE_BUILD_ID = package_build.getNumber() + PACKAGE_BUILD_URL = new URI([env.JENKINS_URL, "job", "ceph-dev-pipeline", PACKAGE_BUILD_ID].join("/")).normalize() + } + } + } + stage('push ceph release tag') { + steps { + script { + def pushTagJob = build( + job: 'ceph-tag', + parameters: [ + string(name: 'VERSION', value: env.VERSION ?: ''), + string(name: 'BRANCH', value: env.BRANCH ?: ''), + booleanParam(name: 'FORCE_VERSION', value: env.FORCE_VERSION), + string(name: 'RELEASE_TYPE', value: env.RELEASE_TYPE ?: ''), + booleanParam(name: 'RELEASE_BUILD', value: true), + booleanParam(name: 'TAG', value: env.TAG), + string(name: 'TAG_PHASE', value: 'push') + ], + ) + CEPH_TAG_PUSH_JOB_ID = pushTagJob.getNumber() + CEPH_TAG_PUSH_JOB_URL = new URI([env.JENKINS_URL, "job", "ceph-tag", CEPH_TAG_PUSH_JOB_ID].join("/")).normalize() + } + } + } + } +} diff --git a/ceph-release-pipeline/config/definitions/ceph-release-pipeline.yml b/ceph-release-pipeline/config/definitions/ceph-release-pipeline.yml new file mode 100644 index 00000000..ac65e3ac --- /dev/null +++ b/ceph-release-pipeline/config/definitions/ceph-release-pipeline.yml @@ -0,0 +1,97 @@ +- job: + name: ceph-release-pipeline + description: 'This Jenkins pipeline creates upstream release tags, and packages.' + project-type: pipeline + quiet-period: 1 + concurrent: true + pipeline-scm: + scm: + - git: + url: https://github.com/ceph/ceph-build + branches: + - ${{CEPH_BUILD_BRANCH}} + shallow-clone: true + submodule: + disable: true + wipe-workspace: true + script-path: ceph-release-pipeline/build/Jenkinsfile + lightweight-checkout: true + do-not-fetch-tags: true + + parameters: + - string: + name: BRANCH + description: "The release branch to build (e.g., pacific)" + default: main + + - string: + name: VERSION + description: "The version for release, e.g. 0.94.4" + + - bool: + name: TEST + description: | + If this is unchecked, then the builds will be pushed to chacra with the correct ref. This is the default. + + If this is checked, then the builds will be pushed to chacra under the 'test' ref. + + - bool: + name: TAG + description: | + When this is checked, Jenkins will remove the previous private tag and recreate it again, changing the control files and committing again. When this is unchecked, Jenkins will not do any commit or tag operations. If you've already created the private tag separately or are re-running a build, leave this unchecked. + Defaults to checked. + default: true + + - bool: + name: THROWAWAY + description: | + Default: False. When True it will not POST binaries to chacra. Artifacts will not be around for long. Useful to test builds. + default: false + + - bool: + name: FORCE_VERSION + description: | + Default: False. When True it will force the Debian version (when wanting to release older versions after newer ones have been released. + Mostly useful for DEBs to append the `-b` flag for dhc.) + default: false + + - bool: + name: FORCE + description: | + If this is unchecked, then then nothing is built or pushed if they already exist in chacra. This is the default. + + If this is checked, then the binaries will be built and pushed to chacra even if they already exist in chacra. + + - choice: + name: RELEASE_TYPE + description: | + STABLE: A normal release. Builds from BRANCH branch and pushed to BRANCH-release branch. + RELEASE_CANDIDATE: A normal release except the binaries will be pushed to chacra using the $BRANCH-rc name + HOTFIX: Builds from BRANCH-release branch. BRANCH-release will be git merged back into BRANCH. + SECURITY: Builds from BRANCH-release branch in ceph-private.git (private repo). + choices: + - STABLE + - RELEASE_CANDIDATE + - HOTFIX + - SECURITY + + - string: + name: DISTROS + description: "A list of distros to build for. Available options are: centos9, noble, jammy, focal, bionic, xenial, trusty, precise, wheezy, jessie, buster, bullseye, 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: CEPH_BUILD_BRANCH + description: "Use the Jenkinsfile from this ceph-build.git branch" + default: main + + + wrappers: + - build-name: + name: "#${{BUILD_NUMBER}} ${{BRANCH}}, ${{VERSION}}" + -- 2.39.5