Jakub Josef | 4edd743 | 2017-05-10 17:58:56 +0200 | [diff] [blame] | 1 | package com.mirantis.mk |
| 2 | |
| 3 | /** |
| 4 | * |
| 5 | * Jenkins common functions |
| 6 | * |
| 7 | */ |
| 8 | |
| 9 | /** |
| 10 | * Get Jenkins job running builds |
| 11 | * @param jobName job name |
| 12 | * @return list of running builds |
| 13 | */ |
Jakub Josef | fbe8c7c | 2017-05-11 13:35:11 +0200 | [diff] [blame] | 14 | @NonCPS |
Jakub Josef | 4edd743 | 2017-05-10 17:58:56 +0200 | [diff] [blame] | 15 | def getJobRunningBuilds(jobName){ |
Jakub Josef | fbe8c7c | 2017-05-11 13:35:11 +0200 | [diff] [blame] | 16 | def job = Jenkins.instance.items.find{it -> it.name.equals(jobName)} |
| 17 | if(job){ |
| 18 | return job.builds.findAll{build -> build.isBuilding()} |
| 19 | } |
| 20 | return [] |
Jakub Josef | 4edd743 | 2017-05-10 17:58:56 +0200 | [diff] [blame] | 21 | } |