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

Aborted builds should be reported to Bitbucket as STOPPED

XMLWordPrintable

      JENKINS-32940 extended the Bitbucket build status notifier both with handling of aborted builds by reporting them as FAILED and with complexity surrounding retried builds. However, the API supports another state, STOPPED, that seems far more appropriate for aborted builds. In Bitbucket's own CI service, Bitbucket Pipelines, STOPPED is the status applied when stopping/cancelling/aborting an in-progress build.

      A cursory glance reveals a special-case for aborted builds that forces the status to be FAILED in https://github.com/jenkinsci/bitbucket-build-status-notifier-plugin/blob/1.4.0/src/main/java/org/jenkinsci/plugins/bitbucket/BitbucketBuildStatusHelper.java#L212-L213. It seems like this special-case should be removed.

      FYI, this snippet seems to cause aborted builds to be reported as failed so nothing currently is broken or would be broken by this change:

      post {
        success {
          bitbucketStatusNotify(buildState: 'SUCCESSFUL')
        }
        failure {
          bitbucketStatusNotify(buildState: 'FAILED')
        }
        unstable {
          bitbucketStatusNotify(buildState: 'FAILED')
        }
        aborted {
          bitbucketStatusNotify(buildState: 'STOPPED')
        }
      }
      

            flagbit Antonio Mansilla
            itsmkj Mikkel Kjeldsen
            Votes:
            3 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: