Extend function for finding Jenkins job with regex
Find Jenkins job not only by plain name, but also by
using regexp.
Change-Id: If3886a2ded14fdd704e75d93c214c9fb48f950e8
diff --git a/src/com/mirantis/mk/JenkinsUtils.groovy b/src/com/mirantis/mk/JenkinsUtils.groovy
index daf68c3..0434814 100644
--- a/src/com/mirantis/mk/JenkinsUtils.groovy
+++ b/src/com/mirantis/mk/JenkinsUtils.groovy
@@ -125,9 +125,9 @@
* @param jobName job name
* @return job object that matches jobName
*/
-def getJobByName(jobName){
+def getJobByName(jobName, regexp=false){
for(item in Hudson.instance.items) {
- if(item.name == jobName){
+ if (regexp && item.name ==~ jobName || item.name == jobName) {
return item
}
}