如何从Jenkins的上游项目复制工件? [英] How to copy artifacts from upstream project in Jenkins?

查看:92
本文介绍了如何从Jenkins的上游项目复制工件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个上游项目(Pro1,Pro2).两个上游项目都存档工件.我想创建一个下游项目,以复制触发下游项目的上游项目中的工件.

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.

例如,如果下游由Pro1触发,那么它将从Pro1而不是Pro2复制工件.在Jenkins中,我可以配置一个项目以复制其他项目中的工件,但是我必须指定其他项目名称.在这种情况下,如何指定运行时项目名称?

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?

推荐答案

这是您所需方案的一种实现方法,

This is one way of implementation approach for your required scenario,

将上游作业名称作为输入参数传递给下游作业.

Pass Upstream Job name to Downstream Job as input parameter.

使用有条件的BuildStep插件检查哪个Job触发了下游使用作业名称输入参数.通过使用此添加条件语句来检查并复制各个Job中的工件.

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.

这篇关于如何从Jenkins的上游项目复制工件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆