#290 CI/CD: Fix `scratch` field in ci.container-image.test.complete messages
Closed 2 years ago by rayson. Opened 2 years ago by rayson.
rayson/waiverdb cicd-fix-scratch-2  into  master

@@ -87,6 +87,7 @@ 

              branches: [[name: params.WAIVERDB_GIT_REF]],

              userRemoteConfigs: [[url: params.WAIVERDB_GIT_REPO, refspec: '+refs/heads/*:refs/remotes/origin/* +refs/pull/*/head:refs/remotes/origin/pull/*/head']],


+           env.WAIVERDB_GIT_COMMIT = scmVars.GIT_COMMIT

            // Generate a version-release number for the target Git commit

            def versions = sh(returnStdout: true, script: 'source ./version.sh && echo -en "$WAIVERDB_VERSION\n$WAIVERDB_CONTAINER_VERSION"').split('\n')

            env.WAIVERDB_VERSION = versions[0]
@@ -219,7 +220,7 @@ 

              def processed = openshift.process(template,

                "-p", "NAME=${env.BUILDCONFIG_INSTANCE_ID}",

                '-p', "WAIVERDB_GIT_REPO=${params.WAIVERDB_GIT_REPO}",

-               '-p', "WAIVERDB_GIT_REF=${params.WAIVERDB_GIT_REF}",


                '-p', "WAIVERDB_IMAGE_TAG=${env.TEMP_TAG}",

                '-p', "WAIVERDB_VERSION=${env.WAIVERDB_VERSION}",

@@ -290,7 +291,7 @@ 

                def buildSelector = testBcSelector.startBuild(

                    '-e', "IMAGE=${env.RESULTING_IMAGE_REPO}:${env.RESULTING_TAG}",

                    '-e', "WAIVERDB_GIT_REPO=${params.WAIVERDB_GIT_REPO}",

-                   '-e', "WAIVERDB_GIT_REF=${params.WAIVERDB_GIT_REF}",

+                   '-e', "WAIVERDB_GIT_REF=${params.WAIVERDB_GIT_REF == params.WAIVERDB_MAIN_BRANCH ? env.WAIVERDB_GIT_COMMIT : params.WAIVERDB_GIT_REF}",

                    '-e', "IMAGE_IS_SCRATCH=${params.WAIVERDB_GIT_REF != params.WAIVERDB_MAIN_BRANCH}",


                echo 'Waiting for the integration test result...'

@@ -225,12 +225,9 @@ 

                        openshift.withProject("${DEV_PIPELINE_BC_NAMESPACE}") {

                          def bcSelector = openshift.selector('bc', "${DEV_PIPELINE_BC_NAME}")

                          echo 'Starting a dev pipeline build...'

-                         def isMaster = env.PAGURE_POLLING_FOR_PR != 'true'

                          def devBuild = bcSelector.startBuild(

                            '-e', "WAIVERDB_GIT_REPO=${env.GIT_URL}",

-                           '-e', "WAIVERDB_GIT_REF=${isMaster? env.GIT_COMMIT : env.GIT_BRANCH}",

-                           '-e', "FORCE_PUBLISH_IMAGE=${isMaster}",

-                           '-e', "FORCE_PUBLISH_DOCS=${isMaster}",

+                           '-e', "WAIVERDB_GIT_REF=${env.GIT_BRANCH}",

                            '-e', "WAIVERDB_MAIN_BRANCH=${PAGURE_POLLED_BRANCH}",

                            '-e', "BUILD_DISPLAY_RENAME_TO=${currentBuild.displayName}",


Following up https://pagure.io/waiverdb/pull-request/282.

This PR changes the pagure polling job to pass the original branch name
rather than commit ID to waiverdb-dev job on master branch changes.
waiverdb-dev then passes commit ID to downstream container build and integration test jobs
to ensure the exact same commit is processed.

@mikeb Please take a look again. Thank you!

@rayson This fix was included in https://pagure.io/waiverdb/pull-request/284 right? If so, let's close this.

@mikeb Yes, I accidentally submitted this patch with #284. So close this...

Pull-Request has been closed by rayson

2 years ago