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

Locked resource(s) should be inherited from calling job

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • Jenkins 2.263.4, lockable-resources-plugin 2.10

      In a declarative pipeline, I typically do

      pipeline {
        options { lock(extra: [[resource: "A"], [resource: "B"], [resource: "C"]]) }
        stages { stage('A') { ... } }
      }
      

      or something like that to lock resources for the job.

      If I call another build in one of the stages

      stage('A') {
        steps {
          script { build job: 'path-to-job' }
        }
      }

      that build must not try to lock the same resources, because they are already locked by the calling job and hence not available.

      Ideally, the plugin would check whether the resources are locked by the calling job, so the called/nested job need not wait for the resources because they are basically already locked for them.

      There might be an elaborate (hence "Major") workaround to implement that check manually and it to the jobs that are called by others, but ideally the plugin itself would handle this case.
       

            Unassigned Unassigned
            raketenolli Oliver
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: