Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-66266

Jenkins plugin sends SUCCESS status to Jira upon failed build in Jenkins pipeline script

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Critical Critical
    • None
    • Jenkins 2.289.3, atlassian-jira-software-cloud-plugin 1.4.4

      Build pipeline:

      #!groovy
      
      env.DOCKER_HOST_IP = '172.17.0.1'
      
      node('jenkins-build-agent') {
          // This limits build concurrency to 1 per branch
          properties([disableConcurrentBuilds()])    
          
          env.JAVA_HOME = "${tool 'jdk8'}"
          
          timeout(10 /* minutes */) {
              ws("workspace/${env.JOB_NAME}") {
                  try {
                    
          
                     stage('Checkout') {
                          git branch: getBranchName(),
                              credentialsId: 'github-token',
                              url: 'https://....git'
                      }
         
          
                      stage('Build') {
                          error("Build failed: test")
                      }
                  } finally {
                      echo "sending jiraSendBuildInfo"
                      jiraSendBuildInfo()
                      echo "finished jiraSendBuildInfo"
                  
                      cleanWs() // clean up workspace    
                  }
              }
          }
      }

      Actual result:

      When a build fails this pipeline sends SUCCESS state into related Jira issue.

       

      Expected result:

      Jenkins should send FAILED status into related Jira issue.

            nsurendran Navya
            abeletsky Andrey Beletsky
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: