问题
I have two upstream projects(Pro1, Pro2). Both of the upstream projects archive artifacts. I want to create one downstream projects to copy artifacts from the upstream project who trigger the downstream project.
For example, if the downstream is triggered by Pro1
, then it will copy the artifacts from Pro1
not Pro2
. In Jenkins, I can configure a project to copy artifacts from other projects but I have to specify the other project name. How can I specify a runtime project name in this case?
回答1:
This is one way of implementation approach for your required scenario,
Pass Upstream Job name to Downstream Job as input parameter.
Use Conditional BuildStep Plugin to check which Job triggered the downstream using the Job name input parameter. By using this add conditional statement to check and copy the artifacts from respective Job.
来源:https://stackoverflow.com/questions/45299288/how-to-copy-artifacts-from-upstream-project-in-jenkins