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

Milestone step should allow to optionally define build result

XMLWordPrintable

      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 superseding 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.

      Proposed API:

      milestone(<ordinal>, <superseded build's result>)
      

            Unassigned Unassigned
            sebastianhaeni Sebastian Häni
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: