Failed build pipeline job with groovy script sending null currentBuild.result

XMLWordPrintable

      Hi,
      I am using pipeline to create a CI with groovy script and my failed job's currentBuild.result is returning null and currentBuild.currentResult as success.
      Can you let me know how can I fix this issue?

      My groovy script is as follows:

      #!groovy

      node('master') {
      // 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: 'feature/NJ-9-featurebranch-for-ci', url: '****.git'
      }
      stage('Build') {
      error("Build failed: test")
      }
      } finally{
      echo "${currentBuild.result}, ${currentBuild.currentResult}"
      jiraSendBuildInfo branch: 'feature/NJ-9-featurebranch-for-ci', site: '***atlassian.net'
      echo "finished jiraSendBuildInfo"
      }

            Assignee:
            Olivier Lamy
            Reporter:
            Navya
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: