[英]Jenkins: Trigger a future build once a job is completed
I can't seem to find the best way to do that. 我似乎找不到最佳的方法。
I have a Jenkins job I ran manually (say a job that creates a temporary file somewhere). 我有一个手动运行的Jenkins作业(例如,在某处创建临时文件的作业)。
I want to be able to clean this up (eg delete the temporary file) after 2-3 hours. 我希望能够在2-3小时后清理(例如删除临时文件)。
I was thinking adding a Post Deploy action that will run a job with some parameters + some delay. 我在考虑添加一个“部署后”操作,该操作将使用某些参数+一些延迟来运行作业。 But I can't find anything like that.
但是我找不到那样的东西。
I've noticed several schedule plugins or REST API options, but nothing that as simple as "When Succesfully Building A, Build B in X minutes". 我注意到几个日程表插件或REST API选项,但没有什么比“成功构建A,在X分钟内构建B”那么简单。
Suggestions? 有什么建议吗?
Suggestions? 有什么建议吗?
You could exploit the Quiet period
. 您可以利用
Quiet period
。
job1 -> (sleep -> fake-job) -> job2 工作1->(睡眠->假工作)->工作2
so let job1 trigger the fake-job whch has a quiet period of 7200 seconds and this fake-job will trigger your cleanup job. 因此,让job1触发假作业,该假作业的安静时间为7200秒,此假作业将触发您的清理作业。
You can use Parameterized Trigger Plugin ( https://wiki.jenkins-ci.org/display/JENKINS/Parameterized+Trigger+Plugin ). 您可以使用参数化触发器插件( https://wiki.jenkins-ci.org/display/JENKINS/Parameterized+Trigger+Plugin )。 Here you can pass predefined parameter to Project to build like sleep_time parameter and you can handle it in triggered Jenkins job.
在这里,您可以将预定义参数传递给Project以像sleep_time参数一样进行构建,并且可以在触发的Jenkins作业中进行处理。 Also you can configure Trigger build on Stable / Unstable / always trigger conditions.
您也可以在稳定/不稳定/始终触发条件下配置触发器构建。
I hope it will be useful for you. 希望对您有用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.