]> git.apps.os.sepia.ceph.com Git - ceph-build.git/commitdiff
ceph-dev-pipeline: Correct environment usage
authorZack Cerza <zack@cerza.org>
Mon, 20 Oct 2025 21:26:06 +0000 (15:26 -0600)
committerZack Cerza <zack@cerza.org>
Tue, 21 Oct 2025 17:06:04 +0000 (11:06 -0600)
The env object is shared across pipeline branches, and we don't want these
values to propagate.

Signed-off-by: Zack Cerza <zack@cerza.org>
ceph-dev-pipeline/build/Jenkinsfile

index abc151faf5ed436bbd5b9df433fb8f7b98e8b46a..76f5275511ed347cf0f96b972b19cca7b5915ceb 100644 (file)
@@ -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
-                '''
+                """
               }
             }
           }