如果今天有另一份工作至少执行一次,请运行詹金斯的工作 [英] Run Jenkins job if another job ran at least once today

查看:73
本文介绍了如果今天有另一份工作至少执行一次,请运行詹金斯的工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想设置一个每天晚上运行的Jenkins作业(我们称之为A),并检查是否另一个Jenkins作业(我们称之为B)今天至少成功运行了一次.我不希望B触发A,因为B每天可能运行多次,但是我希望A仅运行一次-如果B不运行,则根本不运行.

I want to set up a Jenkins job (let's call it A) that would run nightly and check if another Jenkins job (let's call it B) ran successfully at least once today. I don't want B to trigger A because B may run multiple times per day, but I want A to run only once--and not to run at all if B did not run.

我考虑过使用条件步骤"选项,但是我不确定如何配置条件.我知道检查另一个作业的构建时间戳的唯一方法是通过Jenkins restful API,但是如果我通过shell中的curl命令执行此操作,则必须公开Jenkins用户的密码,而我不想这样做(更不用说必须在shell中解析json输出了,我也宁愿避免这样做).

I thought of using the "Conditional step" option, but I'm not sure how to configure the condition. The only way I know of to examine the timestamps for another job's builds is via Jenkins restful API, but if I do it via curl commands in shell, I'd have to expose the Jenkins user's password, which I don't want to do (not to mention having to parse the json output in shell, which I would also rather avoid doing).

有什么建议吗?

推荐答案

您可以使用

You can implement such things nicely with the Script SCM plugin:

  • 您基本上将对作业"A"执行SCM轮询"步骤,并将其作为检查作业"B"是否成功运行的常规脚本
  • 然后将"A"的SCM轮询间隔设置为每晚一次.

这篇关于如果今天有另一份工作至少执行一次,请运行詹金斯的工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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