-
Improvement
-
Resolution: Unresolved
-
Major
-
None
There is a way to dynamically create lockable resource within the jenkins pipeline script using LockableResourcesManager::createResource() and ::createResourceWithLabel(), but there are no API method to remove said resource.
NOTE: Fixing JENKINS-38906 in a way suggested by eeaston could require said method to be developed (as 'transient' resources will be created and removed in pipeline step).
- is related to
-
JENKINS-38906 Remove lock resource name from global configuration when lock is released
-
- Resolved
-
As a workaround, there is a removeAll option that you can say something like remove all resources where name matches 'somestr'. For example this is what I do:
def all_lockable_resources = GlobalConfiguration.all().get(org.jenkins.plugins.lockableresources.LockableResourcesManager.class).resources all_lockable_resources.removeAll { it.name.contains('somestr')}
I use a timestamp in my names and match off that.