Created
November 23, 2016 16:35
-
-
Save nextrevision/5447596a9664f62bf9f80f3600dc860b to your computer and use it in GitHub Desktop.
Loops through jobs by regex printing the job name and the value of the parameter PARAM1
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
import jenkins.model.* | |
def matchedJobs = Jenkins.instance.items.findAll { job -> | |
job.name =~ /job_regex_here/ | |
} | |
matchedJobs.each { job -> | |
def latest = job.getLastSuccessfulBuild() | |
def name = job.name | |
// resolve the parameter | |
def param1 = latest.buildVariableResolver.resolve("PARAM1") | |
println "${name}:${param1}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment