在Jenkins中检索内部版本号或下游内部版本的工件 [英] Retrieve build number or artifacts of downstream build in Jenkins

查看:115
本文介绍了在Jenkins中检索内部版本号或下游内部版本的工件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在詹金斯有一份工作(称为BIGJOB);几个构建步骤是使用

I have a job (call it BIGJOB) in Jenkins; several of the build steps are to trigger builds on other jobs (call them SMALLJOB) using the Parameterized Trigger Plugin then wait for them to complete. What I need to do is retrieve artifacts from the triggered build on SMALLJOB.

最初,我认为我可以使用复制Artifact插件从触发的SMALLJOB的最后构建"中检索工件.当一次仅运行一个SMALLJOB时,这确实可以可靠地工作.

Originally, I thought I could use the Copy Artifact Plugin to retrieve the artifacts from the "last build" of the triggered SMALLJOB. And this does work reliably when there is only one SMALLJOB running at a time.

但是我有多个正在运行的BIGJOB,它们都触发了多个SMALLJOB,因此使用最后一次构建"并不可靠,因为两个SMALLJOB同时完成.

But I've got multiple BIGJOBs running, all triggering multiple SMALLJOBs so that using the "last build" is unreliable of two SMALLJOBs finish at the same time.

是否有更可靠的方法来从特定的下游作业中获取工件?如果我可以获取内部版本号,则可以使用curl来获取工件.

Is there a more reliable way of getting the artifacts from the specific downstream job? If I could just get the build number, I could use curl to get the artifacts.

推荐答案

将来在这个问题上是否还有其他问题:

Just if any (else) stumples accross this question in the future:

在使用参数化触发器插件作为构建步骤时,如果将触发器配置为启用阻止,直到触发的项目完成其构建",则以下环境变量可用于进一步的构建步骤:

When using the Parameterized Trigger Plugin as a build step, then if the trigger is configured with the "Block until the triggered projects finish their builds" enabled, the following Environment variables are made available for further build steps:

  • LAST_TRIGGERED_JOB_NAME =上一个项目已启动"
  • TRIGGERED_BUILD_NUMBER_ {项目名称} =上次触发的内部版本号"

从2.17版起

  • TRIGGERED_JOB_NAMES =用逗号分隔的所有已触发项目的列表"
  • TRIGGERED_BUILD_NUMBERS_ {项目名称} =用逗号分隔的已触发内部版本列表"
  • TRIGGERED_BUILD_RESULT_ {项目名称} =上次触发项目的生成结果"
  • TRIGGERED_BUILD_RESULT_ {项目名称} RUN {内部版本号} =内部版本号触发的内部版本的结果"
  • TRIGGERED_BUILD_RUN_COUNT_ {项目名称} =为项目触发的构建数量"

在插件网站上查看更多信息-问题中的链接.

See more info on the plugin website - linked in the question.

这篇关于在Jenkins中检索内部版本号或下游内部版本的工件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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