Skip to content

Instantly share code, notes, and snippets.

@leonowski
Created December 11, 2020 10:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leonowski/332498b12365e730ef9c0ca17876df0f to your computer and use it in GitHub Desktop.
Save leonowski/332498b12365e730ef9c0ca17876df0f to your computer and use it in GitHub Desktop.
jenkins script to remove some lockable resources
def manager = org.jenkins.plugins.lockableresources.LockableResourcesManager.get()
def resources = manager.getResources().findAll {
(!it.locked) && (
it.name.contains("PR-") ||
it.name.contains("hotfix-") ||
it.name.contains("feature-")
)
}
resources.each {
println "Removing ${it.name}"
manager.getResources().remove(it)
}
manager.save()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment