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

236 views
Skip to first unread message

mikkel.kjeldsen@sallinggroup.com (JIRA)

unread,
Aug 17, 2018, 2:54:02 AM8/17/18
to jenkinsc...@googlegroups.com
Mikkel Kjeldsen updated an issue
 
Jenkins / Improvement JENKINS-53082
Aborted builds should be reported to Bitbucket as STOPPED
Change By: Mikkel Kjeldsen
Summary: Aborted builds should be reported to BitBucket Bitbucket as STOPPED
Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.10.1#710002-sha1:6efc396)

mikkel.kjeldsen@sallinggroup.com (JIRA)

unread,
Aug 17, 2018, 2:57:02 AM8/17/18
to jenkinsc...@googlegroups.com
Mikkel Kjeldsen updated an issue
JENKINS-32940 extended the Bitbucket added build status notifier both with handling of aborted builds If a build is configured to notify BitBucket when the build starts, by reporting them as {{FAILED}} and the build is then aborted with complexity surrounding retried builds. However , [ the BitBucket build status remains as 'In Progress' API|https://developer .

If another build of the same project is started for the same
atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/ commit /%7Bnode%7D/statuses] supports another state , a new build is started in BitBucket {{STOPPED}} , 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
that seems far more appropriate for aborted build as failed builds. In Bitbucket's own CI service , and to overwrite Bitbucket Pipelines, {{STOPPED}} is the build status applied when another project stopping/cancelling/aborting an in-progress build job starts for the same commit .

mikkel.kjeldsen@sallinggroup.com (JIRA)

unread,
Aug 17, 2018, 3:00:08 AM8/17/18
to jenkinsc...@googlegroups.com
Mikkel Kjeldsen updated an issue
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@sallinggroup.com (JIRA)

unread,
Aug 17, 2018, 3:05:02 AM8/17/18
to jenkinsc...@googlegroups.com


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}
Reply all
Reply to author
Forward
0 new messages