How to restart from a checkpoint and mutate a build parameter in Pipeline?

Issue

It would be nice to restart from a checkpoint, and mutate a build parameter. The use case here is someone clicks “run from this checkpoint” and unchecks the platforms (on by default) they do not wish to rerun.

Environment

  • CloudBees Jenkins Platform
  • Pipeline Plugin

Resolution

This can be accomplished by storing the original build number before creating a checkpoint, and then comparing the stored build number against the current build number whenever you want to know if the build has resumed:

def origBuildNumber = BUILD_NUMBER
checkpoint 'about to run'
def platforms
if (origBuildNumber == BUILD_NUMBER) {
  platforms = 'amd64,linux,solaris,NT'
} else {
  // resumed build
  def selections = input ???
  platforms = ???using selections???
}
node {
  sh "make clean all -plats=${platforms}"
}
Have more questions? Submit a request

2 Comments

  • 0
    Avatar
    Daniel Martin

    Could you put more information as the the issue you are trying to solve, along with better context around the resolution.

  • 0
    Avatar
    James Brown

    Hi Daniel,

    I've updated more of the article with the original ask along with some additional context in the resolution. If you have any additional questions please don't hesitate to raise the same in a case!

Please sign in to leave a comment.