Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-46235

API does not allow to remove lockable resource

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      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 Edward Easton could require said method to be developed (as 'transient' resources will be created and removed in pipeline step).

        Attachments

          Issue Links

            Activity

            Hide
            travispavek Travis Pavek added a comment -

            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.

            Show
            travispavek Travis Pavek added a comment - 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.

              People

              • Assignee:
                Unassigned
                Reporter:
                mireksz Mirek Sz
              • Votes:
                2 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated: