Hi, is there a specific reason you don't use this structure?

withEnv(['MY_VAR=VAL']) {
    // some block
}

Regards,
Andreas

On Tuesday, April 24, 2018 at 5:31:47 PM UTC+2, Daniel Belenky wrote:
>
> 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.
>
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/f7e86348-8371-4501-98b0-372a66642efc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to