Created
February 26, 2018 13:45
-
-
Save AdamSaleh/a8b9a029a17bfad98b210a8d7c94cb50 to your computer and use it in GitHub Desktop.
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
| //https://github.com/jenkinsci/jenkins-scripts/blob/master/scriptler/buildJobsMatchingPattern.groovy | |
| import jenkins.model.* | |
| import hudson.model.* | |
| def jobPattern = args[0] | |
| // Pattern to search for. Regular expression. | |
| //def jobPattern = "test_.*" | |
| def matchedJobs = Jenkins.instance.items.findAll { job -> | |
| job.name =~ /$jobPattern/ | |
| } | |
| matchedJobs.each { job -> | |
| println "Scheduling matching job ${job.name}" | |
| job.scheduleBuild(new Cause.UserIdCause()) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment