Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ingorichter/1106058 to your computer and use it in GitHub Desktop.
Save ingorichter/1106058 to your computer and use it in GitHub Desktop.
groovy cli script to display all jobs with a perforce scm configuration
def jobs = hudson.model.Hudson.instance.items
jobs.each { job ->
def scm = job.scm
if (scm.class.name == 'hudson.plugins.perforce.PerforceSCM') {
println "Job '${job.name}' uses the following perforce configuration"
println '-' * 80
println "P4Port: ${scm.getP4Port()}"
println "P4Client: ${scm.getP4Client()}"
println "P4User: ${scm.getP4User()}"
println "P4Password: ${scm.getP4Passwd()}"
println '=' * 80
}
}
@mohanss08
Copy link

mohanss08 commented Jun 18, 2020

Thanks for the script it works perfectly for free-style jobs. Do you have one for pipeline (Written in Jenkins GUI) based?

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