Hi,
I'm trying to configure an environment variable during the Pipeline that later on should be
expanded by Gerrit Trigger Plugin. I've tried to implement EnvironmentContributingAction
and add it to currentBuild.rawBuild object but it seems like it doesn't do the job.
I've also tried to import the implementation of EnvironmentContributingAction from
EnvInject plugin without success as well.
Here is an example of what I've tried to do:
I've configured a variable named "MY_VAR" using EnvInject plugin and tried to modify it
during the build. Then, I'd expected to see the updated value when printing the environment
but changes don't seem to take effect.
import org.jenkinsci.plugins.envinject.*
import hudson.model.*
Map<String, String> m = new HashMap<String, String>()
m['MY_VAR'] = 'VAL'
def build = currentBuild.rawBuild
build.addAction(new EnvInjectPluginAction(m))
println(build.getEnvironment())
Maybe someone encountered a similar issue before and can share some experience?
Or am I doing something wrong here?
Thanks,
Daniel.