Last active
May 29, 2017 06:15
-
-
Save TheDauthi/11316074 to your computer and use it in GitHub Desktop.
Gets a list of SCMs in use by Jenkins. Displays the list of remote configs.
This file contains 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
import hudson.model.* | |
// Only detect jobs that have the SCM property available | |
jobs = Hudson.instance.getAllItems().findAll { | |
job -> job.hasProperty("scm") | |
} | |
// Cheap formatting hack =) | |
maxWidth = Collections.max(jobs.collect { job -> job.fullName.length() }) | |
format = "%-" + (maxWidth + 4) + "s" | |
for(job in jobs) | |
{ | |
if(job.scm.hasProperty("userRemoteConfigs")) { | |
urls = job.scm.userRemoteConfigs.collect { | |
remote -> remote.url | |
} | |
println sprintf(format, job.fullName) + urls | |
} | |
else | |
println sprintf(format, job.fullName) + "[]" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment