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/558d06f1-85e7-4e66-9366-2aebb1bc68b8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.