Skip to content

Instantly share code, notes, and snippets.

@odavid
Created September 14, 2017 15:55
Show Gist options
  • Save odavid/76b6874ed2b421b3eeb838aec0e9e040 to your computer and use it in GitHub Desktop.
Save odavid/76b6874ed2b421b3eeb838aec0e9e040 to your computer and use it in GitHub Desktop.
A short script to delete free locks from the lockable resources plugin
def manager = org.jenkins.plugins.lockableresources.LockableResourcesManager.get()
def resources = manager.getResources().findAll{
!it.locked
}
resources.each{
manager.getResources().remove(it)
}
manager.save()
@AaronDMarasco-VSI
Copy link

Thanks. I modified line 3 to do searches using the lock's name, e.g. !it.locked && it.name.startsWith("docker_deploy")

@pavoltravnik
Copy link

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment