How to pass a build number within the MultiJob plugin?

匿名 (未验证) 提交于 2019-12-03 08:36:05

问题:

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



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!