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

          Nigel Harniman created issue -
          Nigel Harniman made changes -
          Description Original: 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”
          }

          New: 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”
          }

          Nigel Harniman made changes -
          Description Original: 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”
          }

          New: 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”
          }

          This would be highly appreciated for controlling nodes that can run one (1) instance of a software that's needed in a build at a time. A different approach would be 'labelled executors', or alternatively 'virtual slaves'. Personally I would prefer such a solution to resource locking (of course, counting software licences is a different use case).

          Thomas Goeppel added a comment - This would be highly appreciated for controlling nodes that can run one (1) instance of a software that's needed in a build at a time. A different approach would be 'labelled executors', or alternatively 'virtual slaves'. Personally I would prefer such a solution to resource locking (of course, counting software licences is a different use case).

          Jesse Glick added a comment -

          Hmm, I filed JENKINS-29461 for the locks-and-latches plugin but it seems to have disappeared from JIRA! (Recorded in COMPATIBILITY.md on Tue Jul 21.) Anyway that plugin seems abandoned? So this is better.

          As written LockableResource is not ready for Workflow because its state is transient.

          Jesse Glick added a comment - Hmm, I filed JENKINS-29461 for the locks-and-latches plugin but it seems to have disappeared from JIRA! (Recorded in COMPATIBILITY.md on Tue Jul 21.) Anyway that plugin seems abandoned? So this is better. As written LockableResource is not ready for Workflow because its state is transient .
          Jesse Glick made changes -
          Issue Type Original: Improvement [ 4 ] New: New Feature [ 2 ]

          Code changed in jenkins
          User: Nigel Harniman
          Path:
          COMPATIBILITY.md
          http://jenkins-ci.org/commit/workflow-plugin/c8a97fd333a28a388c4b64c97ad7eeddc9f3a125
          Log:
          JENKINS-30269 noting.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Nigel Harniman Path: COMPATIBILITY.md http://jenkins-ci.org/commit/workflow-plugin/c8a97fd333a28a388c4b64c97ad7eeddc9f3a125 Log: JENKINS-30269 noting.
          Jesse Glick made changes -
          Link New: This issue is duplicated by JENKINS-30757 [ JENKINS-30757 ]

          A suggested work around for this problem is documented in ticket JENKINS-31343. However, if the delay on the resource would be rather long (several hours to a day or more) the frequency of the resource check would be so slow that you easily loose an hour before detecting that the resource has been freed.

          Xavier Van Dessel added a comment - A suggested work around for this problem is documented in ticket JENKINS-31343 . However, if the delay on the resource would be rather long (several hours to a day or more) the frequency of the resource check would be so slow that you easily loose an hour before detecting that the resource has been freed.

          Jesse Glick added a comment -

          JENKINS-31343 does not really have much to do with this, I think, since waitUntil is not a useful workaround for this RFE unless you already have an external resource locking system you can use.

          Jesse Glick added a comment - JENKINS-31343 does not really have much to do with this, I think, since waitUntil is not a useful workaround for this RFE unless you already have an external resource locking system you can use.

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

              Created:
              Updated:
              Resolved: