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

Aborted builds should be reported to Bitbucket as STOPPED

      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')
        }
      }
      

          [JENKINS-53082] Aborted builds should be reported to Bitbucket as STOPPED

          Mikkel Kjeldsen created issue -
          Mikkel Kjeldsen made changes -
          Link New: This issue relates to JENKINS-52214 [ JENKINS-52214 ]
          Mikkel Kjeldsen made changes -
          Link New: This issue relates to JENKINS-32940 [ JENKINS-32940 ]
          Mikkel Kjeldsen made changes -
          Link Original: This issue relates to JENKINS-52214 [ JENKINS-52214 ]
          Mikkel Kjeldsen made changes -
          Description Original: If a build is configured to notify BitBucket when the build starts, and the build is then aborted, the BitBucket build status remains as 'In Progress'.

          If another build of the same project is started for the same commit, a new build is started in BitBucket, but the status remains as 'In Progress.

          This appears to be caused by the unique Jenkins build ID being used in the build key supplied to BitBucket.

          It would be preferable to mark an aborted build as failed, and to overwrite the build status when another project build job starts for the same commit.
          New: JENKINS-32940 extended the Bitbucket added handling of aborted builds If a build is configured to notify BitBucket when the build starts, and the build is then aborted, the BitBucket build status remains as 'In Progress'.

          If another build of the same project is started for the same commit, a new build is started in BitBucket, but the status remains as 'In Progress.

          This appears to be caused by the unique Jenkins build ID being used in the build key supplied to BitBucket.

          It would be preferable to mark an aborted build as failed, and to overwrite the build status when another project build job starts for the same commit.
          Mikkel Kjeldsen made changes -
          Summary Original: Aborted builds should be reported to BitBucket as STOPPED New: Aborted builds should be reported to Bitbucket as STOPPED
          Mikkel Kjeldsen made changes -
          Description Original: JENKINS-32940 extended the Bitbucket added handling of aborted builds If a build is configured to notify BitBucket when the build starts, and the build is then aborted, the BitBucket build status remains as 'In Progress'.

          If another build of the same project is started for the same commit, a new build is started in BitBucket, but the status remains as 'In Progress.

          This appears to be caused by the unique Jenkins build ID being used in the build key supplied to BitBucket.

          It would be preferable to mark an aborted build as failed, and to overwrite the build status when another project build job starts for the same commit.
          New: 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|https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/commit/%7Bnode%7D/statuses] 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.
          Mikkel Kjeldsen made changes -
          Description Original: 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|https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/commit/%7Bnode%7D/statuses] 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. New: 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|https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/commit/%7Bnode%7D/statuses] 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.
          Mikkel Kjeldsen made changes -
          Description Original: 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|https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/commit/%7Bnode%7D/statuses] 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.
          New: 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|https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/commit/%7Bnode%7D/statuses] 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:

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

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

              Created:
              Updated: