Skip to content

Instantly share code, notes, and snippets.

@mario21ic
Created August 29, 2017 19:17
Show Gist options
  • Select an option

  • Save mario21ic/40068b46cbeba6bb51d5a07ccbe232c1 to your computer and use it in GitHub Desktop.

Select an option

Save mario21ic/40068b46cbeba6bb51d5a07ccbe232c1 to your computer and use it in GitHub Desktop.
Function to get the last successfull build in Jenkins
def lastSuccessfullBuild(build) {
if(build != null && build.result != 'FAILURE') {
return build.number;
} else {
lastSuccessfullBuild(build.previousBuild);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment