You can use 'stash' to solve this problem since you can't count on the same
workspace in part 3 as in part 1 nor, if it is the same workspace can you
count on it being unchanged in the interim. You can get confused by trying
it and maybe you do get it this time but not next time. Further, depending
on whether one build agent has the both labels, A and B, all three parts
could happen in the same workspace.

node('A') {
    ... some stuff that creates the files you want to use in part 3
(perhaps load stuff from source code repo and build everything)
     stash 'stuff'
 }
node('B') { }
node('A') {
    unstash 'stuff'
     .... use those files
 }

You need to understand the implications of what stash does. Basically it
takes all files in the workspace (unless you specify specific ones) and
stores them compressed on the master. the unstash retrieves them and puts
them in the workspace. Perhaps you want to delete the workspace content
before unstashing or maybe move to a subfolder.

On Thu, Nov 2, 2017 at 10:14 AM, Andreas Tscharner <[email protected]>
wrote:

> On 30.10.2017 03:50, Daniel Becroft wrote:
>
>> Hi,
>> I'm experimenting with the scripted pipeline, and have a question about
>> the use of node('') with a label. If I have the following scenario:
>>
>> node('A') { }
>> node('B') { }
>> node('A') { // Which node will be used here? }
>>
>> Is there any guarantee that the second node() step for "A" will hit the
>> same slave as the first one, or will it use whichever slave is now
>> available? I'd like for the first node() to allocate one from the pool of
>> slaves with the label of "A", but then the second one to somehow reuse the
>> first one (there might be some cleanup tasks, etc that need to happen on
>> the original node).
>>
>
> I would try something like this:
>
> node('A') {
>   ...
>   ...
>   node('B') {
>     ...
>     ...
>   }
>   ...
>   ...
> }
>
> HTH and best regards
>         Andreas
> --
> Andreas Tscharner                             [email protected]
>
> Gordon's Law:
> If you think you have the solution, the question was poorly phrased.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Users" 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/ms
> gid/jenkinsci-users/2ca95dc7-20f3-385e-bf87-c88dd8888ef5%40gmail.com.
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
-- Lee Meador
Sent from gmail. My real email address is lee AT leemeador.com

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" 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-users/CAA4vtDQtkcOO0cZ%2BOW8gU68uA_RqT1cacnsYXjg1E0bnOJ7nMA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to