Skip to content

Instantly share code, notes, and snippets.

@jakubjosef
Created July 24, 2017 13:50
Show Gist options
  • Select an option

  • Save jakubjosef/2d849dde575bdd2d0a46b27a3226c46c to your computer and use it in GitHub Desktop.

Select an option

Save jakubjosef/2d849dde575bdd2d0a46b27a3226c46c to your computer and use it in GitHub Desktop.
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")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment