问题
The MultiJob plugin is great and I want to use it for my build process, but there is one issue I have to solve before: There are three jobs A, B and C. SVN triggers job A and B (parallel execution) and job C starts when A and B have finished. Job C requires the artifacts from job A and B as an input.
-> Job A (with A.zip)
Trigger -> Job C (use artifacts A.zip and B.zip)
-> Job B (with B.zip)
To design the workflow with the MultiJob plugin is easy, but I have no clue how to get the corresponding artifacts from job A and B in job C. Can I pass the build numbers to job C (buildNr(A) != buildNr(B))? Or is there a smarter way to solve the issue?
回答1:
The multijob plugin sets the following environment variables per job (code):
<JOBNAME>_BUILD_NUMBER
<JOBNAME>_BUILD_RESULT
Where JOBNAME
is created by the name of the job with all non characters and numbers replaced with _
. Thus you can pass the build numbers as parameters to Job C:
回答2:
There's a workaround using EnvInject and a groovy script: https://issues.jenkins-ci.org/browse/JENKINS-20241
来源:https://stackoverflow.com/questions/16061427/how-to-pass-a-build-number-within-the-multijob-plugin