Jenkins: Sharing variables in MultiJob

前端 未结 4 1673
暗喜
暗喜 2021-01-18 02:00

I\'m using Jenkins for testing/build purposes, so I created a MultiJob project with this configuration:

  1. Test Job
  2. Build Job
  3. Install Job
  4. <
4条回答
  •  无人及你
    2021-01-18 02:25

    The question asks how to pass values between jobs for MultiJob projects, not Parameterized Trigger. Parameterized Trigger might not be a good solution because the downstream job will be executed outside of the scope of the MultiJob parent. To pass variables between MultiJob sub-jobs,

    1. Write variables to a property file in the first sub-job
    2. "Archive the artifacts" as post-build action in the first sub-job
    3. Between the first and second sub-jobs, insert an "Copy artifacts from another project" build. Set Project Name to the name of your first sub-job and Which Build to "Build triggered by current MultiJob build". Add your property file in "Artifacts to copy".
    4. In your second sub-job, under "Advanced...", Add parameters -> Parameters from properties file, and enter your property file name there. Your second phase will now have variables passed from your first phase.

提交回复
热议问题