blob: 0a5fa2a868635c1d63b1a2eeae63b74597b1cbb9 [file] [log] [blame]
Jakub Joseff7283ee2017-03-20 19:10:13 +01001/**
2 * Long running jobs killer
3 *
4 * MAX_DURATION_IN_HOURS - max permitted job duration in hours
5 */
6common = new com.mirantis.mk.Common()
Jakub Josefa14b3b02017-06-05 19:15:41 +02007jenkinsUtils = new com.mirantis.mk.JenkinsUtils()
Jakub Joseff7283ee2017-03-20 19:10:13 +01008
Jakub Josef05c8a4e2017-03-23 16:40:59 +01009node{
10 stage("Kill long running jobs"){
Jakub Josef05c8a4e2017-03-23 16:40:59 +010011 for (int i=0; i < Jenkins.instance.items.size(); i++) {
Jakub Josefa14b3b02017-06-05 19:15:41 +020012 if(!jenkinsUtils.killStuckBuilds(3600 * Integer.parseInt(MAX_DURATION_IN_HOURS), Jenkins.instance.items[i])){
13 common.errorMsg("Kill failed!")
14 }
Jakub Josef05c8a4e2017-03-23 16:40:59 +010015 }
Jakub Joseff7283ee2017-03-20 19:10:13 +010016 }
Jakub Josef05c8a4e2017-03-23 16:40:59 +010017}