Skip to content

Instantly share code, notes, and snippets.

@bbeck
Last active January 19, 2018 00:17
Show Gist options
  • Save bbeck/f9f159802242c55d3e9e37ddfabaaa46 to your computer and use it in GitHub Desktop.
Save bbeck/f9f159802242c55d3e9e37ddfabaaa46 to your computer and use it in GitHub Desktop.
Jenkins milestone issue

Pipeline #1

stage("build") {
  echo "in build"
}

stage("deploy to prod") {
  input message: "Deploy to prod?"
  milestone(ordinal: 20, label: "prod")
  echo "deploying to prod"
}

Pipeline #2

stage("build") {
  echo "in build"
}

stage("deploy to test") {
  milestone(ordinal: 10, label: "test")
  echo "deploying to test"
}

stage("deploy to prod") {
  input message: "Deploy to prod?"
  milestone(ordinal: 20, label: "prod")
  echo "deploying to prod"
}
@bbeck
Copy link
Author

bbeck commented Jan 19, 2018

After creating a pipeline job with Pipeline #2 and starting 3 invocations, Jenkins looks like this:

image

Also, going to the script console and executing this code:

import org.jenkinsci.plugins.pipeline.milestone.*
println Jenkins.instance.getDescriptor(MilestoneStep.class).getMilestonesByOrdinalByJob()

Produces this output:

[milestone-test-2:[10:Milestone[inSight=[1, 2, 3]]]]

This shows all 3 builds having hit the milestone.

Next, if I abort build #2 then Jenkins looks like this:

image

It doesn't seem like consistent behavior with the first pipeline I showed, or even correct behavior for Build #1 to be aborted after aborting Build #2.

Am I misunderstanding something, or is this a bug?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment