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

Select the Nth allocated workspace from the upstream job

      Currently, The upstream job may allocate multiple workspaces, by calling multiple times the exwsAllocate step. In this case, when this run is selected in the downstream job, the exwsAllocate step from the downstream job will choose the first workspace that was allocated in the upstream job.
      e.g.

      Upstream Pipeline

      // upstream job allocates workspaces from two different Disk Pools
      def extWorkspace1 = exwsAllocate 'diskpool1'
      def extWorkspace2 = exwsAllocate 'diskpool2'
      // ...
      

      Downstream Pipeline

      def run = selectRun 'upstream-job-name'
      // the downstream job will choose the first allocated workspace from the upstream job
      def extWorkspace = exwsAllocate selectedRun: run
      

      This feature allows the user to select a specific workspace that was allocated in the upstream job. For this, an extra parameter may be needed for the exwsAllocate step.
      Each allocated workspace has its own auto-generated unique id, so we can make use of that.
      e.g.

      def extWorkspace = exwsAllocate selectedRun: run, workspaceId: 'unique-workspace-id'
      

          [JENKINS-37079] Select the Nth allocated workspace from the upstream job

          It is better for the user to specify the workspace using a constant expression, otherwise the job needs to be reconfigured each time it runs. I think this is what you mean with the 'unique-workspace-id'. In any case this is a low priority item at this time.

          Martin d'Anjou added a comment - It is better for the user to specify the workspace using a constant expression, otherwise the job needs to be reconfigured each time it runs. I think this is what you mean with the 'unique-workspace-id'. In any case this is a low priority item at this time.

            alexsomai Alexandru Somai
            alexsomai Alexandru Somai
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: