Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins EnvInject plugin + Pipeline job

I would like to use EnvInject plugin within my pipeline job. So, I have a possibility to set checkbox "Prepare an environment for the run", but there is no action "Inject environment variables", like in freestyle job. I declared my variables in "Properties Content" block:enter image description here

How to inject environment variables in pipeline job using EnvInject?

like image 511
Sviatlana Avatar asked Jun 20 '16 08:06

Sviatlana


People also ask

What is EnvInject?

EnvInject captures build environment variables populated by plugins providing environment variables through Jenkins extension points (such as BuildWrappers, EnvironmentContributions and so on).


1 Answers

If you declared following variables in "Properties Content" block:

param1=value1
param2=value2

Then you can get them into pipeline here so:

//do something
def par1 = env.param1
def par2 = env.param2
like image 60
Anton Shishkin Avatar answered Oct 17 '22 05:10

Anton Shishkin