epcim of DevOps
8/17/2017 - 4:01 PM

Disable Jenkins jobs with condition

Disable Jenkins jobs with condition

def jobs = Jenkins.instance.items.findAll { it.name.startsWith("test") || it.name.startsWith("deploy") }
def counter = 0
for (job in  jobs) {
    job.disabled = true
    counter++
}
print("Disabled ${counter} jobs")