Manipulating environmental variables

This recipe shows you how to pass variables from Jenkins to your build Job and how different variables are overwritten. It also describes one way of failing the build if crucial information has not been correctly passed.

Jenkins has a number of plugins for passing information to builds including the Setenv plugin (https://wiki.jenkins-ci.org/display/JENKINS/Setenv+Plugin), Envfile plugin (https://wiki.jenkins-ci.org/display/JENKINS/Envfile+Plugin), and the EnvInject plugin (https://wiki.jenkins-ci.org/display/JENKINS/EnvInject+Plugin). The Envinject plugin was chosen for this recipe as it is reported to work with nodes and offers a wide range of property injection options.

Getting ready

Install the Envinject ...

Get Jenkins Continuous Integration Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.