Created
January 22, 2015 01:34
-
-
Save dnozay/df73a74d983bcd15011f to your computer and use it in GitHub Desktop.
build-flow-plugin, change existing builds' displayName to include the git branch's name where applicable.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// for all builds from build-flow-plugin whose parameters include a GIT_BRANCH paramater, | |
// change the displayName to include branch and build number | |
import com.cloudbees.plugins.flow.*; | |
jobs = Jenkins.instance.getAllItems(BuildFlow); | |
jobs.each { it -> | |
it.builds.each { b -> | |
GIT_BRANCH = b.envVars['GIT_BRANCH'] | |
( GIT_BRANCH =~ /(?:refs\/remotes\/)?(.+)/ ).each { full,branch -> | |
b.displayName = branch + ' (#' + b.number + ')' | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment