#296 CI/CD: Allow to customize messaging providers for integration test jobs
Merged 5 years ago by rayson. Opened 5 years ago by rayson.

@@ -43,6 +43,9 @@ 

    displayName: environment name (dev/stage/prod)

    required: true

    value: dev

+ - name: MESSAGING_PROVIDER

+   displayName: Name of the JMS messaging provider

+   value: Red Hat UMB

  objects:

  - kind: ServiceAccount

    apiVersion: v1
@@ -98,4 +101,6 @@ 

            value: "${NAME}-jenkins-slave"

          - name: ENVIRONMENT

            value: "${ENVIRONMENT}"

+         - name: MESSAGING_PROVIDER

+           value: "${MESSAGING_PROVIDER}"

          jenkinsfilePath: openshift/pipelines/templates/waiverdb-integration-test.Jenkinsfile

@@ -160,11 +160,15 @@ 

    post {

      always {

        script {

+         if (!env.IMAGE_DIGEST) {

+           // Don't send a message if the job fails before getting the image digest.

+           return;

+         }

          // currentBuild.result == null || currentBuild.result == 'SUCCESS' indicates a successful build,

          // because it's possible that the pipeline engine hasn't set the value nor seen an error when reaching to this line.

          // See example code in https://jenkins.io/doc/book/pipeline/jenkinsfile/#deploy

          def sendResult = sendCIMessage \

-           providerName: 'Red Hat UMB', \

+           providerName: params.MESSAGING_PROVIDER, \

            overrides: [topic: 'VirtualTopic.eng.ci.container-image.test.complete'], \

            messageType: 'Custom', \

            messageProperties: '', \
@@ -209,9 +213,14 @@ 

              "version": "0.1.0"

            }

            """

-         // echo sent message id and content

-         echo sendResult.getMessageId()

-         echo sendResult.getMessageContent()

+         if (sendResult.getMessageId()) {

+           // echo sent message id and content

+           echo 'Successfully sent the test result to ResultsDB.'

+           echo "Message ID: ${sendResult.getMessageId()}"

+           echo "Message content: ${sendResult.getMessageContent()}"

+         } else {

+           echo 'Failed to sent the test result to ResultsDB.'

+         }

        }

      }

    }

For C3I pipeline job debugging purpose.

rebased onto cb54427712234169e29ee3d4cc33cd3aa5c2f62c

5 years ago

rebased onto 590b612

5 years ago

Commit 2eb9669 fixes this pull-request

Pull-Request has been merged by rayson

5 years ago

Pull-Request has been merged by rayson

5 years ago