Here's the hack. The example assumes I don't need the files as such in the 
main workflow, just the contents:

def planNumberOne
node('planners') {

  // ...
  // slurp up the file and pass it "outside" the block
  planNumberOne = readFile 'plans/plan_1'

}

// Lo and behold, the override sticks back out here in the main flow. 
// This variable is not null, it has the contents of plans/plan_1 and 
// the echo displays them.
echo planNumberOne

I did not expect it to work nor understand why it works. I knew you could 
pass an outer workflow variable into the *node* block but thought this was 
a one-way street. Ie that the block could see the value and possibly 
override it, but that the workflow would retain the original value.

On Friday, October 30, 2015 at 9:40:02 AM UTC-7, Brian Ray wrote:
>
> The *unstash *step outside of a *node *block is illegal, because it wants 
> a workspace to unstash to:
>
> node('planners') {
>
>   // ...
>   // do a bunch of stuff then stash the product
>   stash( name: 'plans', includes: 'plans/*' )
>
> }
>
> // this is unwrapped and will throw a MissingContextVariableException
> unstash 'plans'
>
> Is there a hack to *unstash *files out into the main workflow, or an 
> equivalent that doesn't use *stash *and *unstash*? I'm attempting to 
> offload some of the planning and preparation for downstream flow logic into 
> the *planners *pool at the top of the flow. The main workflow would then 
> use that output to split out chunks of work via *parallel*.
>

-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/dde23bec-7be9-41fc-a652-09ec55227d35%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to