#282 CI/CD: Correct `scratch` values in ci.container-image.test.complete messages
Merged 5 years ago by rayson. Opened 5 years ago by rayson.
rayson/waiverdb cicd-fix-scratch-field  into  master

@@ -291,6 +291,7 @@ 

                    '-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', "IMAGE_IS_SCRATCH=${params.WAIVERDB_GIT_REF != params.WAIVERDB_MAIN_BRANCH}",

                  )

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

                timeout(time: 20) { // 20 min

@@ -80,6 +80,8 @@ 

            value: "${WAIVERDB_GIT_REF}"

          - name: "IMAGE"

            value: "${IMAGE}"

+         - name: IMAGE_IS_SCRATCH

+           value: "false"

          - name: "CONTAINER_REGISTRY_CREDENTIALS"

            value: "${CONTAINER_REGISTRY_CREDENTIALS}"

          - name: "TEST_ID"

@@ -191,7 +191,7 @@ 

                "digest": "${env.IMAGE_DIGEST}",

                "nvr": "waiverdb:${env.IMAGE_TAG}",

                "issuer": "c3i-jenkins",

-               "scratch": true

+               "scratch": ${params.IMAGE_IS_SCRATCH}

              },

              "system":

                 [{

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

scratch field should be set to true for a PR test while false for other tests. New job parameter IMAGE_IS_SCRATCH is introduced to indicate if the tested container image is "scratch".

Pull-Request has been merged by rayson

5 years ago

@rayson IMAGE_IS_SCRATCH is always going to be true, because according to:

https://pagure.io/waiverdb/blob/master/f/openshift/pipelines/templates/waiverdb-polling-pagure.yaml#_231

when polling the master branch, the WAIVERDB_GIT_REF is always passed as a commit hash, not as a branch name.

@mikeb You are right. Let me think if there is a better solution for this.