Skip to end of metadata
Go to start of metadata

Plugin Information

View build-env-propagator on the plugin site for more information.

This plugin lets you add new build environment variables, override a pre-defined and existing variables at each build 
step. Set of variables defined at a build step is carried over to the sub-sequent build steps. Any subsequent build step
 can override any variable defined by the previous build step.

Usage

Click on Build->Add Build Step->Propagate build environment variables, and then enter environment variables (key value pairs) to be accessible in your next build step. You can also override previously define environment variable key, this includes Jenkins defined build environment keys as well.

Any successive Propagate build environment variables step will override previously defined environment variable values.

You can also add environment variable using Jenkins CLI:

 $ java -jar cli.jar set-env-variables -m key1=val1 -m key2=val2
  • No labels

3 Comments

  1. This seems to duplicate the EnvInject Plugin but with less functionality.  How do you see this being used over what is already available?

    1. Envinject plugin might be doing other things but it does not propagate env variables across build steps, it won't also let you override build env variables across build steps as well. 

      This plugin is focused on adding/propagating/overriding environment variables in build steps. It's light weight, written using just 3-4 classes. Envinject is bit convoluted plugin for such simple tasks, so no I won't touch that.

      1. Hi, your plugin is exactly what I need for my script. The problem is it doesn't seem to be doing what it should.

        I define environment variables in your plugin as follows:

        PROJECT_BASE=test:ARCHIVE_PATH=:PACKAGE_PATH=:CONTINUE_BUILD=0
        

        In my next step I do this:

        echo $PROJECT_BASE
        
        PROJECT_BASE=/some/path
        
        echo $PROJECT_BASE
        

        This has the desired effect of printing "/some/path"

        I expect to be able to assign values to these variables and use them across subsequent build steps as well. However, my steps do not see value changes made in previous steps.

        For example, when I do this in my next step:

        echo $PROJECT_BASE
        

        i get "test" instead of "/some/path"

        In this sense, it all works just like it would with EnvInject plugin. Perhaps, I am not doing something right. Please advise.

        Thank you.