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

If lock() creates a new resource, there should be a choice to make it temporary

      I'm using lock() in the stage options of a declarative pipeline and really like the feature to automatically create the resource if it does not yet exist.  That should save some maintenance.  However as time goes on and resources change, this means the number of resources builds up until someone cleans them out.

      We should have a choice for manually created locks to be temporary - i don't necessarily care whether the resource exists when no one is using it, just that only one job use it at a time.

       

      May be related to: JENKINS-34892

       

      The overall scenario is related to Jenkins agents - I want a stage to deploy a server, followed by stages to execute client tests, but I need the server locked the whole time so that no other job tries to use it.  Currently I'm stuck with double maintenance, keeping the same server list in both the agent and the lockable resources.  If lock() both lets me create resources on the fly and declare them temporary so they are deleted when no one is using them, then I don't need duplicate maintenance - I only need to maintain the agents, not the lock data.

          [JENKINS-55486] If lock() creates a new resource, there should be a choice to make it temporary

          D Pasto added a comment -

          I can see several ways of addressing this issue - this ticket is a small improvement that will get us a nice improvement, while JENKINS-53332 addresses the scenario, and JENKINS-44141 is a larger goal but is short on detail

          D Pasto added a comment - I can see several ways of addressing this issue - this ticket is a small improvement that will get us a nice improvement, while  JENKINS-53332 addresses the scenario, and  JENKINS-44141  is a larger goal but is short on detail

          ethorsa added a comment -

          There's a pending PR on Github addressing this .

          ethorsa added a comment - There's a pending PR on Github addressing this .

          ethorsa added a comment -

          PR#138 has been merged so the next release should ship it. 

          ethorsa added a comment - PR#138 has been merged so the next release should ship it. 

          D Pasto added a comment -

          Fantastic, thanks!  Unfortunately  I don't have a sandbox to try pre-release versions.  I see the last release of this plugin was in March, so I'll keep an eye out for it.

          D Pasto added a comment - Fantastic, thanks!  Unfortunately  I don't have a sandbox to try pre-release versions.  I see the last release of this plugin was in March, so I'll keep an eye out for it.

          Released with 2.6

          Tobias Gruetzmacher added a comment - Released with 2.6

            tgr Tobias Gruetzmacher
            wgc123 D Pasto
            Votes:
            4 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: