Currently, you need at least one resource for a label.
      When I try to lock on a label and no resource exists (yet) for that label, pipeline fails with

       

      java.lang.IllegalArgumentException: The resource label does not exist: my_label.
      at org.jenkins.plugins.lockableresources.LockStepResource.validate(LockStepResource.java:95)
      at org.jenkins.plugins.lockableresources.LockStep.validate(LockStep.java:183)
      at org.jenkins.plugins.lockableresources.LockStepExecution.start(LockStepExecution.java:43)

      use case:
      I want to create a pool of resources (testsystems btw) to be used in a build pipeline. The resources are created on-demand by a separated groovy-script job.
      During nighttimes the pool will be completely empty though, and the build pipeline will so fail hard instead of waiting for the next resource
       

          [JENKINS-71247] Support labels without associated resources

          kutzi added a comment -

          My workaround is now to create a dummy lock (i.e. one without an associated testsystem) and reserve the lock indefinitely

          kutzi added a comment - My workaround is now to create a dummy lock (i.e. one without an associated testsystem) and reserve the lock indefinitely

          kutzi added a comment - - edited

          Alternative approach would be to skip the label validation when trying to acquire a lock on a label.
          Then any label name should be accepted - irrespective if a resource already exists for that label

          kutzi added a comment - - edited Alternative approach would be to skip the label validation when trying to acquire a lock on a label. Then any label name should be accepted - irrespective if a resource already exists for that label

            Unassigned Unassigned
            kutzi kutzi
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: