[JIRA] (JENKINS-61296) Milestone step should allow to optionally define build result

4 views
Skip to first unread message

haeni.sebastian@gmail.com (JIRA)

unread,
Mar 2, 2020, 12:32:03 PM3/2/20
to jenkinsc...@googlegroups.com
Sebastian Häni created an issue
 
Jenkins / New Feature JENKINS-61296
Milestone step should allow to optionally define build result
Issue Type: New Feature New Feature
Assignee: Unassigned
Components: workflow-multibranch-plugin
Created: 2020-03-02 17:31
Labels: multi-branch milestone
Priority: Minor Minor
Reporter: Sebastian Häni

The milestone step cancels older builds with result NOT_BUILT.

It should be possible to optionally override this behavior and set it to something else, e.g. ABORTED.

Use case:

I want to cancel older PR builds by using this code:

def buildNumber = env.BUILD_NUMBER as int
if (buildNumber > 1) {
  // aborting previous builds by passing their milestone
  milestone(buildNumber - 1)
}
// creating milestone for current build
milestone(buildNumber)

This works as expected, older builds are cancelled with result NOT_BUILT. Now I am using the Bitbucket Branch Source Plugin to automatically report the build status to Bitbucket. In that plugin, the status NOT_BUILT gets mapped to SUCCESS in Bitbucket. If I have a Merge Check to prevent merging of the PR, I now have a situation that the build result is SUCCESS even though it never ran.

So I want to be able to customize the cancelled build's result by overriding it in the milestone step.
The new parameter is optional, and if not overriden, the behavior should be exactly as it was before.

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.13.12#713012-sha1:6e07c38)
Atlassian logo

haeni.sebastian@gmail.com (JIRA)

unread,
Mar 2, 2020, 12:34:04 PM3/2/20
to jenkinsc...@googlegroups.com
Sebastian Häni updated an issue
Change By: Sebastian Häni
The {{milestone}} step cancels older builds with result {{NOT_BUILT}}.

It should be possible to optionally override this behavior and set it to something else, e.g. {{ABORTED}}.


Use case:

I want to cancel older PR builds by using this code:
{code:java}

def buildNumber = env.BUILD_NUMBER as int
if (buildNumber > 1) {
  // aborting previous builds by passing their milestone
  milestone(buildNumber - 1)
}
// creating milestone for current build
milestone(buildNumber){code}

This works as expected, older builds are cancelled with result {{NOT_BUILT}}. Now I am using the Bitbucket Branch Source Plugin to automatically report the build status to Bitbucket. In that plugin, the status {{NOT_BUILT}} gets mapped to {{SUCCESS}} in Bitbucket. If I have a Merge Check to prevent merging of the PR, I now have a situation that the build result is {{SUCCESS}} even though it never ran.


So I want to be able to customize the cancelled build's result by overriding it in the milestone step.
The new parameter is optional, and if not overriden, the behavior should be exactly as it was before.


Proposed API:
{code}
milestone(<ordinal>, <surpassed build's result>)
{code}

haeni.sebastian@gmail.com (JIRA)

unread,
Mar 2, 2020, 12:36:02 PM3/2/20
to jenkinsc...@googlegroups.com
Sebastian Häni updated an issue
The {{milestone}} step cancels older builds with result {{NOT_BUILT}}.

It should be possible to optionally override this behavior and set it to something else, e.g. {{ABORTED}}.

Use case:

I want to cancel older PR builds by using this code:
{code:java}
def buildNumber = env.BUILD_NUMBER as int
if (buildNumber > 1) {
  // aborting previous builds by passing superseding their milestone

  milestone(buildNumber - 1)
}
// creating milestone for current build
milestone(buildNumber){code}

This works as expected, older builds are cancelled with result {{NOT_BUILT}}. Now I am using the Bitbucket Branch Source Plugin to automatically report the build status to Bitbucket. In that plugin, the status {{NOT_BUILT}} gets mapped to {{SUCCESS}} in Bitbucket. If I have a Merge Check to prevent merging of the PR, I now have a situation that the build result is {{SUCCESS}} even though it never ran.

So I want to be able to customize the cancelled build's result by overriding it in the milestone step.
The new parameter is optional, and if not overriden, the behavior should be exactly as it was before.

Proposed API:
{code}
milestone(<ordinal>, < surpassed superseded build's result>)
{code}
Reply all
Reply to author
Forward
0 new messages