Created
December 1, 2016 07:48
-
-
Save alces/0289166c072d2dbfb54f9a9ccf63c5cb to your computer and use it in GitHub Desktop.
Set environment variables during a Jenkins build using Groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// should be run as Groovy System Script | |
import hudson.EnvVars | |
import hudson.model.Environment | |
def build = Thread.currentThread().executable | |
def vars = [ENV_VAR1: 'value1', ENV_VAR2: 'value2'] | |
build.environments.add(0, Environment.create(new EnvVars(vars))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment