In a Freestyle job where I use the Build Step portion of this plugin, I can
set the ENV variable and get it via a shell call of:
echo ${key}
So, it just does not work in the Pipeline Build Step.
-Jimmy
On Wednesday, 2 November 2016 16:48:01 UTC-4, Jimmy Ray wrote:
>
> In a wrapper plugin that I wrote, I set and environment string like so:
>
> context.env(key, value);
>
> Where "context" is that which is passed in like so:
>
> @Override
> public void setUp(Context context, Run<?, ?> run, FilePath filePath,
> Launcher launcher, TaskListener
> listener, EnvVars envVars) throws IOException,
> InterruptedException {...
>
>
> I am trying to do the same with a pipeline step plugin:
>
> final EnvVars environment = build.getEnvironment(listener); ...
>
>
> environment.addLine(String.format("%s=%s", key, value));
>
> The wrapper works fine, and env.<key> works fine. However, the step is
> not working. In the step I log:
>
> logger.println(String.format("Stored ENV variable (k,v): %s=%s", key,
> environment.get(key)));
>
> So, in the logs I see:
>
> Stored ENV variable (k,v): test_key=42
>
>
> However, when I use the echo call I see null for the ENV var at that key:
>
> echo env.test_key
>
> So, I assume I have to do something else to get the ENV variable into the
> right environment to be used after the step call? Am I missing some kind
> of scoping issue with steps?
>
> -Jimmy
>
--
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/302ebc5e-2da2-4f96-a5fd-1da0d4472a01%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.