Add support to use this plugin from workflow to manage concurrent consumption of resources.

      Similar to how stage step works as blocked scoped to control concurrency of other builds for this job running this step at the same time, it would be useful to be able to do this for resources across jobs.

      Continue to allow the resources to be set up in the Jenkins configuration.

      Consumption of resources should be controlled with a syntax along these lines:

      For a single resource:

      resource (name: db-a-1, reservedVariable: DB_RESOURCE) {

      // Do something here that uses the resource

      echo “DB Resource(s) used = $DB_RESOURCE”
      }

      For a pool of resources sharing a label:

      resource (label: db-a, quantity: 2, reservedVariable: DB_RESOURCE) {

      // Do something here that uses the resource

      echo “DB Resource(s) used = $DB_RESOURCE”
      }

          [JENKINS-30269] Add workflow support for resource locking

          Code changed in jenkins
          User: Antonio Muñiz
          Path:
          pom.xml
          src/main/java/org/jenkins/plugins/lockableresources/LockStepExecution.java
          src/test/java/org/jenkins/plugins/lockableresources/LockStepTest.java
          http://jenkins-ci.org/commit/lockable-resources-plugin/59049a56a3441497536c6938786b2da98945a537
          Log:
          JENKINS-30269 Take advantage of TailCall

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Antonio Muñiz Path: pom.xml src/main/java/org/jenkins/plugins/lockableresources/LockStepExecution.java src/test/java/org/jenkins/plugins/lockableresources/LockStepTest.java http://jenkins-ci.org/commit/lockable-resources-plugin/59049a56a3441497536c6938786b2da98945a537 Log: JENKINS-30269 Take advantage of TailCall

          Code changed in jenkins
          User: Antonio Muñiz
          Path:
          pom.xml
          src/main/java/org/jenkins/plugins/lockableresources/LockStep.java
          src/main/java/org/jenkins/plugins/lockableresources/LockStepExecution.java
          src/main/java/org/jenkins/plugins/lockableresources/LockableResource.java
          src/main/java/org/jenkins/plugins/lockableresources/LockableResourcesManager.java
          src/test/java/org/jenkins/plugins/lockableresources/LockStepTest.java
          http://jenkins-ci.org/commit/lockable-resources-plugin/e75f02e91c4df6d982d92dc47906ff282465a2a4
          Log:
          JENKINS-30269 Jenkins restart support

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Antonio Muñiz Path: pom.xml src/main/java/org/jenkins/plugins/lockableresources/LockStep.java src/main/java/org/jenkins/plugins/lockableresources/LockStepExecution.java src/main/java/org/jenkins/plugins/lockableresources/LockableResource.java src/main/java/org/jenkins/plugins/lockableresources/LockableResourcesManager.java src/test/java/org/jenkins/plugins/lockableresources/LockStepTest.java http://jenkins-ci.org/commit/lockable-resources-plugin/e75f02e91c4df6d982d92dc47906ff282465a2a4 Log: JENKINS-30269 Jenkins restart support

          Code changed in jenkins
          User: Antonio Muñiz
          Path:
          src/main/java/org/jenkins/plugins/lockableresources/LockStep.java
          src/main/java/org/jenkins/plugins/lockableresources/LockStepExecution.java
          src/main/java/org/jenkins/plugins/lockableresources/LockableResource.java
          src/main/java/org/jenkins/plugins/lockableresources/LockableResourcesManager.java
          src/main/java/org/jenkins/plugins/lockableresources/RequiredResourcesProperty.java
          src/main/resources/org/jenkins/plugins/lockableresources/LockStep/config.jelly
          src/main/resources/org/jenkins/plugins/lockableresources/LockStep/help-maxWaiting.html
          src/main/resources/org/jenkins/plugins/lockableresources/LockStep/help-resource.html
          src/test/java/org/jenkins/plugins/lockableresources/LockStepTest.java
          http://jenkins-ci.org/commit/lockable-resources-plugin/9617986b388c2bc20f8d63b8f5162f0f2091dd7e
          Log:
          JENKINS-30269 Add step configuration page + limit waiting builds

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Antonio Muñiz Path: src/main/java/org/jenkins/plugins/lockableresources/LockStep.java src/main/java/org/jenkins/plugins/lockableresources/LockStepExecution.java src/main/java/org/jenkins/plugins/lockableresources/LockableResource.java src/main/java/org/jenkins/plugins/lockableresources/LockableResourcesManager.java src/main/java/org/jenkins/plugins/lockableresources/RequiredResourcesProperty.java src/main/resources/org/jenkins/plugins/lockableresources/LockStep/config.jelly src/main/resources/org/jenkins/plugins/lockableresources/LockStep/help-maxWaiting.html src/main/resources/org/jenkins/plugins/lockableresources/LockStep/help-resource.html src/test/java/org/jenkins/plugins/lockableresources/LockStepTest.java http://jenkins-ci.org/commit/lockable-resources-plugin/9617986b388c2bc20f8d63b8f5162f0f2091dd7e Log: JENKINS-30269 Add step configuration page + limit waiting builds

          Code changed in jenkins
          User: Antonio Muñiz
          Path:
          pom.xml
          src/main/java/org/jenkins/plugins/lockableresources/LockStepExecution.java
          src/main/java/org/jenkins/plugins/lockableresources/LockableResource.java
          src/main/java/org/jenkins/plugins/lockableresources/LockableResourcesManager.java
          src/main/java/org/jenkins/plugins/lockableresources/actions/LockableResourcesRootAction.java
          src/main/java/org/jenkins/plugins/lockableresources/queue/LockRunListener.java
          http://jenkins-ci.org/commit/lockable-resources-plugin/a14014bdbbfbe2a76f7a97bf7b2add0aa92796d2
          Log:
          JENKINS-30269 Supress polling for locking and use StepContext to notify locks in the same Pipeline build

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Antonio Muñiz Path: pom.xml src/main/java/org/jenkins/plugins/lockableresources/LockStepExecution.java src/main/java/org/jenkins/plugins/lockableresources/LockableResource.java src/main/java/org/jenkins/plugins/lockableresources/LockableResourcesManager.java src/main/java/org/jenkins/plugins/lockableresources/actions/LockableResourcesRootAction.java src/main/java/org/jenkins/plugins/lockableresources/queue/LockRunListener.java http://jenkins-ci.org/commit/lockable-resources-plugin/a14014bdbbfbe2a76f7a97bf7b2add0aa92796d2 Log: JENKINS-30269 Supress polling for locking and use StepContext to notify locks in the same Pipeline build

          Code changed in jenkins
          User: Antonio Muñiz
          Path:
          src/main/java/org/jenkins/plugins/lockableresources/LockStep.java
          src/main/java/org/jenkins/plugins/lockableresources/LockStepExecution.java
          src/main/java/org/jenkins/plugins/lockableresources/LockableResource.java
          src/main/java/org/jenkins/plugins/lockableresources/LockableResourcesManager.java
          src/test/java/org/jenkins/plugins/lockableresources/LockStepTest.java
          http://jenkins-ci.org/commit/lockable-resources-plugin/9fe73b1ce5b7276caa3270741e2ae82c582436d8
          Log:
          JENKINS-30269 Add inversePrecedence parameter + tests

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Antonio Muñiz Path: src/main/java/org/jenkins/plugins/lockableresources/LockStep.java src/main/java/org/jenkins/plugins/lockableresources/LockStepExecution.java src/main/java/org/jenkins/plugins/lockableresources/LockableResource.java src/main/java/org/jenkins/plugins/lockableresources/LockableResourcesManager.java src/test/java/org/jenkins/plugins/lockableresources/LockStepTest.java http://jenkins-ci.org/commit/lockable-resources-plugin/9fe73b1ce5b7276caa3270741e2ae82c582436d8 Log: JENKINS-30269 Add inversePrecedence parameter + tests

          Code changed in jenkins
          User: Antonio
          Path:
          pom.xml
          src/main/java/org/jenkins/plugins/lockableresources/LockStep.java
          src/main/java/org/jenkins/plugins/lockableresources/LockStepExecution.java
          src/main/java/org/jenkins/plugins/lockableresources/LockableResource.java
          src/main/java/org/jenkins/plugins/lockableresources/LockableResourcesManager.java
          src/main/java/org/jenkins/plugins/lockableresources/RequiredResourcesProperty.java
          src/main/java/org/jenkins/plugins/lockableresources/actions/LockableResourcesRootAction.java
          src/main/java/org/jenkins/plugins/lockableresources/queue/LockRunListener.java
          src/main/java/org/jenkins/plugins/lockableresources/queue/LockableResourcesQueueTaskDispatcher.java
          src/main/java/org/jenkins/plugins/lockableresources/queue/LockableResourcesStruct.java
          src/main/resources/org/jenkins/plugins/lockableresources/LockStep/config.jelly
          src/main/resources/org/jenkins/plugins/lockableresources/LockStep/help-inversePrecedence.html
          src/main/resources/org/jenkins/plugins/lockableresources/LockStep/help-resource.html
          src/test/java/org/jenkins/plugins/lockableresources/LockStepTest.java
          src/test/java/org/jenkins/plugins/lockableresources/LockableResourceTest.java
          http://jenkins-ci.org/commit/lockable-resources-plugin/466adef6c1b0212b2866f3b562a4059040a6109a
          Log:
          Merge pull request #25 from amuniz/JENKINS-30269

          JENKINS-30269 Add pipeline support for resource locking

          Compare: https://github.com/jenkinsci/lockable-resources-plugin/compare/76c93d5f4d1e...466adef6c1b0

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Antonio Path: pom.xml src/main/java/org/jenkins/plugins/lockableresources/LockStep.java src/main/java/org/jenkins/plugins/lockableresources/LockStepExecution.java src/main/java/org/jenkins/plugins/lockableresources/LockableResource.java src/main/java/org/jenkins/plugins/lockableresources/LockableResourcesManager.java src/main/java/org/jenkins/plugins/lockableresources/RequiredResourcesProperty.java src/main/java/org/jenkins/plugins/lockableresources/actions/LockableResourcesRootAction.java src/main/java/org/jenkins/plugins/lockableresources/queue/LockRunListener.java src/main/java/org/jenkins/plugins/lockableresources/queue/LockableResourcesQueueTaskDispatcher.java src/main/java/org/jenkins/plugins/lockableresources/queue/LockableResourcesStruct.java src/main/resources/org/jenkins/plugins/lockableresources/LockStep/config.jelly src/main/resources/org/jenkins/plugins/lockableresources/LockStep/help-inversePrecedence.html src/main/resources/org/jenkins/plugins/lockableresources/LockStep/help-resource.html src/test/java/org/jenkins/plugins/lockableresources/LockStepTest.java src/test/java/org/jenkins/plugins/lockableresources/LockableResourceTest.java http://jenkins-ci.org/commit/lockable-resources-plugin/466adef6c1b0212b2866f3b562a4059040a6109a Log: Merge pull request #25 from amuniz/ JENKINS-30269 JENKINS-30269 Add pipeline support for resource locking Compare: https://github.com/jenkinsci/lockable-resources-plugin/compare/76c93d5f4d1e...466adef6c1b0

          Released as 1.8

          Antonio Muñiz added a comment - Released as 1.8

          Florian Hug added a comment -

          First of all, it's great to finally have workflow support for resource locking.
          However, I couldn't find any possibility to lock, e.g. 3 resources assigned to the label Foo.
          As far as I have understood the documentation and from trying to understand the source code, the workflow support is limited to request a specific resource by name.

          Wouldn't it be great to have the full functionality available in workflows?
          Especially as these use cases were also mentioned by the issue reporter.

          Florian Hug added a comment - First of all, it's great to finally have workflow support for resource locking. However, I couldn't find any possibility to lock, e.g. 3 resources assigned to the label Foo. As far as I have understood the documentation and from trying to understand the source code, the workflow support is limited to request a specific resource by name. Wouldn't it be great to have the full functionality available in workflows? Especially as these use cases were also mentioned by the issue reporter.

          As far as I have understood the documentation and from trying to understand the source code, the workflow support is limited to request a specific resource by name.

          Right.

          Wouldn't it be great to have the full functionality available in workflows?

          Especially as these use cases were also mentioned by the issue reporter.

          Yes. I've tried to cover the most common use-case in a Pipeline world (which is a replacement for stage concurrency: 1). The lock step has been designed to allow the addition of labels and multiple locking in future releases (filed as JENKINS-34268).

          Antonio Muñiz added a comment - As far as I have understood the documentation and from trying to understand the source code, the workflow support is limited to request a specific resource by name. Right. Wouldn't it be great to have the full functionality available in workflows? Especially as these use cases were also mentioned by the issue reporter. Yes. I've tried to cover the most common use-case in a Pipeline world (which is a replacement for stage concurrency: 1 ). The lock step has been designed to allow the addition of labels and multiple locking in future releases (filed as JENKINS-34268 ).

          Code changed in jenkins
          User: Jesse Glick
          Path:
          COMPATIBILITY.md
          http://jenkins-ci.org/commit/pipeline-plugin/7596ae10c2035a6c239e4ce8ca3af4c1ee1f78c8
          Log:
          Noting JENKINS-30269 (CC @amuniz)

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: COMPATIBILITY.md http://jenkins-ci.org/commit/pipeline-plugin/7596ae10c2035a6c239e4ce8ca3af4c1ee1f78c8 Log: Noting JENKINS-30269 (CC @amuniz)

            amuniz Antonio Muñiz
            nharniman Nigel Harniman
            Votes:
            9 Vote for this issue
            Watchers:
            21 Start watching this issue

              Created:
              Updated:
              Resolved: