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

Allow picking a lockable resource from a node label

      This plugin has really helped in the scenario of testing client-server, or cloud applications where we want to lock a deployment across multiple test jobs, however we end up duplicating configuration between lockable resources and node.  A really useful improvement to lockable resources would be to choose the resource from online nodes in a pool represented by a node label.

       

      For example, I currently configure:

      • node label "BACKEND_POOL" representing a pool of Jenkins nodes where I can deploy my applcation back end/services
      • lockable resources "SERVICE_POOL" with the identical list

      Now I have a pipeline like pseudocode: 

       

      stage("Build") {
          build()
      }
      RESOURCE = get lockable resource from SERVICE_POOL
      stage ("Deploy") {
          node (RESOURCE) {
                deploy()
         }
      stage ("Test1") {
         node ("Test") {
            Test1(server=RESOURCE)
         }
      }
      stage ("Test2") {
         node ("Test") {
             Test2 (server=RESOURCE)
         }
      }
      

      However, now I am maintaining the same list of resources in both the node label/pool and the lockable resource pool.  This leads to issues like nodes being locked for deployment even though they are offline, someone adding or deleting a resource from one pool but not the other, or someone taking a node offline in one place but not the other.

       

      Lockable resources should be able to lock a resource from online nodes in a node pool, and keep it locked across multiple stages that require using that resource but not as a node.

          [JENKINS-53332] Allow picking a lockable resource from a node label

          I think this is a dupe/specialized case of JENKINS-44141.

          Aaron D. Marasco added a comment - I think this is a dupe/specialized case of JENKINS-44141 .

          D Pasto added a comment -

          JENKINS-44141  is talking about more complex data than the simple one to many relationship whereas this is integration with node labels/resources.  There is nothing in that ticket that covers this, and they are not necessarily related but certainly could be implemented together.

          D Pasto added a comment - JENKINS-44141   is talking about more complex data than the simple one to many relationship whereas this is integration with node labels/resources.  There is nothing in that ticket that covers this, and they are not necessarily related but certainly could be implemented together.

          David Riemens added a comment -

          my use-case would benefit from this as well: I have several nodes, each of which has a number of resources (of the same type) that I want to be able to be locked.
          I also have nodes that do not have such resource.

          When a job needs such resource, I actually need a node that is online, and has 1 free resource of the (common) label.

          This is not possible right now. I solve this now by creating all the resources by including the node-name and a sequence number in the resource name. So eg for label 'PS-RESOURCE', I would create 4 lockable resources: PS-RS-nodeA-01,PS-RS-nodeA-02,PS-RS-nodeB-01,PS-RS-nodeB-02,

          But this fails when a node goes off-line, as Jenkins has no coupling between the node and the resource. Although I would prefer a solution where the lockable resources are defined in the node configuration, I would also be happy if, for each lockable resource I would have the option to indicate a 'served by node' field which would make the resource unavailable if the node is offline.

          David Riemens added a comment - my use-case would benefit from this as well: I have several nodes, each of which has a number of resources (of the same type) that I want to be able to be locked. I also have nodes that do not have such resource. When a job needs such resource, I actually need a node that is online, and has 1 free resource of the (common) label. This is not possible right now. I solve this now by creating all the resources by including the node-name and a sequence number in the resource name. So eg for label 'PS-RESOURCE', I would create 4 lockable resources: PS-RS-nodeA-01,PS-RS-nodeA-02,PS-RS-nodeB-01,PS-RS-nodeB-02, But this fails when a node goes off-line, as Jenkins has no coupling between the node and the resource. Although I would prefer a solution where the lockable resources are defined in the node configuration, I would also be happy if, for each lockable resource I would have the option to indicate a 'served by node' field which would make the resource unavailable if the node is offline.

            Unassigned Unassigned
            wgc123 D Pasto
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: