Jenkins using File Parameter with MultiJob Project

妖精的绣舞 提交于 2019-12-24 00:25:55

问题


I am using the MultiJob Project in order to implement a process the runs every time there is a push to a certain Git branch.

How can I pass parameters between 2 different jobs (each job is located in a separate MultiJob Phase)

What i tried to do is:

Job A: (Run on the Master - windows)

echo 2 parameters into a new file (Called parameters.properties) that i placed in a shared location (not in the workspace of Job A)

so this file's contnet looks like:

currentBuild=2012-11-27_09-20-50 
currentBranch=master

Job B: (Run on a Linux Slave)

The option of "This build is parametrized" is on.

Added "File Parameter" and only the file name as I also set a custom workspace to the shared location where the file is located.

The i have a shell script that tries to use this parametrs but it doesnt get it.

Please Assist,

Doron


回答1:


The Solution:

  1. in the MultiJob Main Project:

    • Set "This build is parametrized"

      Add 2 Text Parameters (different names since the Job Build is based on Jenkins variable Build_Id which is changed and i want later to set the currentBuild to a constant value and not to a new one)

      • JobBuild

      • JobBranch

  2. On each Job under each MultiJob Phase:

    • Add Predefined Parameters:

      • currentBuild=${JobBuild}

      • currentBranch=${JobBranch}

    untick the "Current job parameters"

    untick the Exposed SCM"



来源:https://stackoverflow.com/questions/13580023/jenkins-using-file-parameter-with-multijob-project

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