-
Bug
-
Resolution: Cannot Reproduce
-
Major
-
None
-
EnvInject 2.1.5
Job DSL 1.69
Jenkins 2.107.2
If I define a pipeline job with environment variables in it, on the second (and subsequent) runs, the environment disappears.
def my_job = pipelineJob("/${ROOT}/${BRANCH_FOLDER}/${pf}/${test}") my_job.with { description "${test} on ${pf} (${BRANCH_FOLDER})".replaceAll('_', ' ') displayName test.replaceAll('_', ' ') definition { cps { script(readFileFromWorkspace('jenkins/runtime/groovy/Jenkinsfile_example_job_to_run.groovy')) sandbox() } } environmentVariables { envs( Upstream_Job_Name: JOB_NAME, Upstream_Job_Build: BUILD_NUMBER, GIT_BRANCH: BRANCH_FOLDER, PLATFORM: pf, COMPONENT_TO_TEST: test, ) keepBuildVariables(true) } quietPeriod 1 // 1 second } // my_job // Launch it! queue(my_job) // should be able to be a string too
- Delete the job
- Run the job
- Save off target job's config.xml on server
- Run the seed job again
- Compare on the server:
$ diff -u ./jobs/Test_Results/jobs/branchname/jobs/pform/jobs/mytest/config.xml /tmp/mytest_good.xml --- ./jobs/Test_Results/jobs/branchname/jobs/pform/jobs/mytest/config.xml 2018-04-27 14:52:08.569820997 -0400 +++ /tmp/mytest_good.xml 2018-04-27 14:51:46.503906858 -0400 @@ -5,6 +5,21 @@ <displayName>mytest</displayName> <keepDependencies>false</keepDependencies> <properties> + <EnvInjectJobProperty plugin="envinject@2.1.5"> + <info> + <propertiesContent>Upstream_Job_Name=seed_job +Upstream_Job_Build=156 +GIT_BRANCH=branchname +HDL_PLATFORM=pform +COMPONENT_TO_TEST=mytest</propertiesContent> + <loadFilesFromMaster>false</loadFilesFromMaster> + </info> + <on>true</on> + <keepJenkinsSystemVariables>true</keepJenkinsSystemVariables> + <keepBuildVariables>true</keepBuildVariables> + <overrideBuildParameters>false</overrideBuildParameters> + <contributors/> + </EnvInjectJobProperty> <jenkins.model.BuildDiscarderProperty> <strategy class="hudson.tasks.LogRotator"> <daysToKeep>-1</daysToKeep>
- is caused by
-
JENKINS-43758 Parameters disappear from pipeline job after running the job
- Reopened
- is related to
-
JENKINS-51144 Parameters given to seed job via pipeline jobDsl don't show up as "Build Variables" in downstream's currentBuild.upstreamBuilds
- Closed