Hello everyone,

I have some concerns about how a specific build from the upstream job 
should be selected in the case of the plugin that I am currently 
developing: https://github.com/jenkinsci/external-workspace-manager-plugin.
Please note that the plugin focus is mainly on Pipeline jobs.
Based on other discussions and suggestions, I have reached to the following 
possible solutions.

I have the following use cases:

   - *Select the last stable (or any other status) build from the upstream 
   job*

1. The first example uses the RunSelector plugin 
<https://github.com/jenkinsci/run-selector-plugin>, that is currently 
refactored, being decoupled from the Copy Artifact plugin.
In this case, I would also need to add a *RunSelectorWrapper* that can be 
applied as a Pipeline step, and return a *RunWrapper* object.

*def run = step([$class: 'RunSelectorWrapper', upstream: 
'upstream-name', selector: [$class: ['PermalinkRunSelector'], id: 
'lastStableBuild']])*

*// this is a step specific to the External Workspace Manager Plugin, that 
accepts as input a RunWrapper object*.
*def extWorksace = exwsAllocate selectedRun: run *

2. Second example is based on creating a complete new step, that can be 
used in the Pipeline code.
This step would return a *RunWrapper* object, that is, in this case, the 
last stable build from the upstream job.

*def run = runSelector upstream: 'upstream-name', status: 'lastStableBuild'*

*// this is a step specific to the External Workspace Manager Plugin, that 
accepts as input a RunWrapper object*.
*def extWorksace = exwsAllocate selectedRun: run*

   - *Select a specific build number from the upstream job*

1. First example, making use of RunSelector plugin

*def run = step([$class: 'RunSelectorWrapper', upstream: 
'upstream-name', selector: [$class: ['SpecificRunSelector'], buildNumber: 
'20']])*

2.  Second example, based on the new created step:

*def run = runSelector upstream: 'upstream-name', buildNumber: 20*

I would really appreciate some feedback.
Thank you,
Alex

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/95d90efd-eca6-450c-b595-1609a1a0ab0d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to