OK, so I have the SimpleBuildWrapper working in regular builds and the 
Pipeline Snippet Generator  I was using this code to test:

      node {
      wrap([$class: 'ConsulKVReadWrapper', reads: [[debugMode: 'ENABLED', 
envKey: 'test_key', key: 'test/test-key', token: '', url: '<URL_HERE>', 
urlOverride: ''], [debugMode: 'ENABLED', envKey: 'test_key_new', key: 
'test/test-key', token: '', url: '<URL_HERE>', urlOverride: '']]]) {
    // some block

    print env.test_key
    print env.test_key_new
    }
}



However, I get nulls in the ENV variables still.  The logs are here:

Started by user Jimmy Ray <http://localhost:8080/user/jimmy>[Pipeline] 
withEnv[Pipeline] {[Pipeline] nodeRunning on master in 
/Users/Shared/Jenkins/Home/jobs/Pipelines/jobs/PipelinePlugin/jobs/Manager/workspace[Pipeline]
 {[Pipeline] wrap

test/test-key
[{"CreateIndex":42815,"ModifyIndex":100829,"LockIndex":0,"Key":"test/test-key","Flags":0,"Value":"dGVzdC12YWx1ZQ=="}]
test-value

Stored ENV variable (k,v):  test_key=null

test/test-key
[{"CreateIndex":42815,"ModifyIndex":100829,"LockIndex":0,"Key":"test/test-key","Flags":0,"Value":"dGVzdC12YWx1ZQ=="}]
test-value

Stored ENV variable (k,v):  test_key_new=null[Pipeline] {[Pipeline] 
echonull[Pipeline] echonull[Pipeline] }[Pipeline] // wrap[Pipeline] }[Pipeline] 
// node[Pipeline] echovalue[Pipeline] echoCI[Pipeline] }[Pipeline] // 
withEnv[Pipeline] End of PipelineFinished: SUCCESS




The code to set ENV variables values in the setUp method is here:

VariableInjectionAction action = new 
VariableInjectionAction(read.getEnvKey(), value);
                run.addAction(action);
                run.getEnvironment(listener);

                if (read.getDebugMode().equals(DebugMode.ENABLED)) {
                    logger.println(String.format("Stored ENV variable 
(k,v):  %s=%s", read.getEnvKey(), run
                            .getEnvironment
                                    (listener).get(read.getEnvKey(), 
null)));
                }



I am getting the string, "test-value" back and logging it, but it is not 
making it into the ENV variables.  Should I be using a different way to 
write the ENV variables?

-Jimmy

On Thursday, 2 June 2016 12:58:08 UTC-4, Jesse Glick wrote:
>
> On Thu, Jun 2, 2016 at 12:36 PM, Jimmy Ray <[email protected] 
> <javascript:>> wrote: 
> > Is setUp called before makeBuildVariables? 
>
> Cannot recall offhand, but anyway as the Javadoc notes, 
> `makeBuildVariables` is not used for Pipeline builds. 
>

-- 
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/2a4c0acb-a3d0-4b06-9705-32902f20f542%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to