The job seeder creates a pipeline job and sets environment variable using job dsl as shown below, this pipeline job triggers another job(say job2) which in turn triggers another job(say job3). I want the environment variable set in seed job to be accessed in the triggered jobs.
pipelineJob("job1"){
description("job1..")
concurrentBuild(false)
environmentVariables(
globalEnv + [TEMP_ENV1 : 'true',
TEMP_ENV2 : 'true'
]
)
definition {
cps {
script(
"""
job1script()
"""
)
}
}
}
I want to access TEMP_ENV1 and TEMP_ENV2 in job3, but both are null in this job. i have a check in script which job3 executes it and it fails, e.g.
if (env.TEMP_ENV1) { }