Skip to content

Instantly share code, notes, and snippets.

@snallami
Last active November 5, 2015 21:03
Show Gist options
  • Save snallami/1186aa7df1111140c95a to your computer and use it in GitHub Desktop.
Save snallami/1186aa7df1111140c95a to your computer and use it in GitHub Desktop.
Jenkins useful tips
1) Groovy script to change build display value
// get current build
def build = Thread.currentThread().executable
// get new value for build
def newBuildName = build.getEnvironment().get('newDisplayVersionj')
// set new display name
try {
if (newBuildName) {
build.displayName = newBuildName
println "Build display name is set to ${newBuildName}"
}
} catch (MissingPropertyException e) {}
2) To find out which jobs are using which plugins
Find out the string which we can grep for in config.xml. Mostly it can be xml node name or attribute
e.g. In case of Job DSL plugin i can grep for pattern# plugin=\"job-dsl*
grep --include=config.xml -rnw '#JENKINSHOME/jobs/' -e "plugin=\"job-dsl*"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment