Re: Setting envrioment variables from plugin running in pipeline script
On Sun, Mar 5, 2017 at 3:35 AM,wrote: > run.addAction(new > VariableInjectionAction("BUILDMASTER_APPLICATION_ID", applicationId)); Well what is this `VariableInjectionAction`? See JENKINS-29144 / JENKINS-29537 / JENKINS-42499. Currently `SimpleBuildStep` is not well suited to tasks which _return_ information to the build. You are probably better off creating a Pipeline-specific `SynchronousNonBlockingStepExecution` or similar, so that the script can assign the return value to a local variable, rather than going through magical environment variable names—which anyway will be confusing if called multiple times, and totally unsafe if those calls are from `parallel` branches. In other words there is a good chance that the design of the plugin as conceived for freestyle projects just does not make sense for Pipeline in general. -- 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 jenkinsci-dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr2-zErq-1iYPoNb5SF%3Dv8CagdxxY5H_PoFLgMNztqNdwg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
Setting envrioment variables from plugin running in pipeline script
I have a plugin I've been updating to support pipeline script (with some help from this forum - thanks guys!). During testing I discovered that the plugin is not setting environment variables when run from a pipeline script, but works fine in a freestyle job. Can anyone suggest anything I might have overlooked? Thanks in advance Andrew *Pipeline Script* This outputs an empty value for %BUILDMASTER_APPLICATION_ID%. node { buildMasterSelectApplication applicationId: '1', deployableId: '1' bat 'echo BUILDMASTER_APPLICATION_ID = %BUILDMASTER_APPLICATION_ID%' } *Code* This is how I'm setting the environment variable public class SelectApplicationBuilder extends Builder implements SimpleBuildStep { @Override public void perform(Run run, FilePath workspace, Launcher launcher, TaskListener listener) throws InterruptedException, IOException { run.addAction(new VariableInjectionAction("BUILDMASTER_APPLICATION_ID", applicationId)); } } -- 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 jenkinsci-dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/3a0afe81-6adf-4cd5-ae54-e8b44999a79e%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.