From 10a1adf87e25f9fd5a2056850a29cacc3317eede Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Mon, 20 Oct 2025 15:26:06 -0600 Subject: [PATCH] ceph-dev-pipeline: Correct environment usage The env object is shared across pipeline branches, and we don't want these values to propagate. Signed-off-by: Zack Cerza --- ceph-dev-pipeline/build/Jenkinsfile | 39 +++++++++++++++++------------ 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/ceph-dev-pipeline/build/Jenkinsfile b/ceph-dev-pipeline/build/Jenkinsfile index abc151fa..76f52755 100644 --- a/ceph-dev-pipeline/build/Jenkinsfile +++ b/ceph-dev-pipeline/build/Jenkinsfile @@ -438,18 +438,20 @@ pipeline { ) bwc_cmd_sccache_flags = "--env-file=${env.WORKSPACE}/.env"; } + def ceph_extra_cmake_args = ""; + def deb_build_profiles = ""; switch (env.FLAVOR) { case "default": - env.CEPH_EXTRA_CMAKE_ARGS+=" -DALLOCATOR=tcmalloc" + ceph_extra_cmake_args += " -DALLOCATOR=tcmalloc" if (env.RELEASE_BUILD?.toBoolean()) { - env.CEPH_EXTRA_CMAKE_ARGS+=" -DWITH_SYSTEM_BOOST=OFF -DWITH_BOOST_VALGRIND=ON" + ceph_extra_cmake_args += " -DWITH_SYSTEM_BOOST=OFF -DWITH_BOOST_VALGRIND=ON" } break case ~/crimson.*/: - env.DEB_BUILD_PROFILES="pkg.ceph.crimson" sh '''#!/bin/bash echo "WITH_CRIMSON=true" >> .env ''' + deb_build_profiles = "pkg.ceph.crimson"; break default: println "FLAVOR=${env.FLAVOR} is invalid" @@ -458,12 +460,14 @@ pipeline { bwc_command = "${bwc_command} ${bwc_cmd_sccache_flags}" if ( os.pkg_type == "deb" ) { def sccache_flag = "-DWITH_SCCACHE=ON" - if ( env.SCCACHE == "true" && ! env.CEPH_EXTRA_CMAKE_ARGS.contains(sccache_flag) ) { - env.CEPH_EXTRA_CMAKE_ARGS = "${env.CEPH_EXTRA_CMAKE_ARGS} ${sccache_flag}" + if ( env.SCCACHE == "true" && ! ceph_extra_cmake_args.contains(sccache_flag) ) { + ceph_extra_cmake_args += " ${sccache_flag}" + } + if ( deb_build_profiles ) { + sh """#!/bin/bash + echo "DEB_BUILD_PROFILES=${deb_build_profiles}" >> .env + """ } - sh '''#!/bin/bash - echo "DEB_BUILD_PROFILES=${DEB_BUILD_PROFILES}" >> .env - ''' bwc_command = "${bwc_command} -e debs" } else if ( env.DIST =~ /^(centos|rhel|rocky|fedora).*/ ) { def rpmbuild_args = "" @@ -479,9 +483,9 @@ pipeline { } else { throw new Exception("DIST '${env.DIST}' is invalid!") } - sh '''#!/bin/bash - echo "CEPH_EXTRA_CMAKE_ARGS=${CEPH_EXTRA_CMAKE_ARGS}" >> .env - ''' + sh """#!/bin/bash + echo "CEPH_EXTRA_CMAKE_ARGS=${ceph_extra_cmake_args}" >> .env + """ sh """#!/bin/bash -ex cd dist/ceph ln ../ceph-${env.VERSION}.tar.bz2 . @@ -612,18 +616,21 @@ pipeline { script { env.CONTAINER_REPO_USERNAME = env.CONTAINER_REPO_CREDS_USR env.CONTAINER_REPO_PASSWORD = env.CONTAINER_REPO_CREDS_PSW - env.DISTRO = sh( + distro = sh( script: '. /etc/os-release && echo -n $ID', returnStdout: true, ) - env.RELEASE = sh( + release = sh( script: '. /etc/os-release && echo -n $VERSION_ID', returnStdout: true, ) - env.cephver = env.VERSION.trim() - sh '''#!/bin/bash + cephver = env.VERSION.trim() + sh """#!/bin/bash + export DISTRO=${distro} + export RELEASE=${release} + export cephver=${cephver} ./scripts/build_container - ''' + """ } } } -- 2.47.3