如何阻止Jenkins作业在特定时间运行 [英] How to block a Jenkins job from running at certain times

查看:137
本文介绍了如何阻止Jenkins作业在特定时间运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个詹金斯(Jenkins)工作,它将重新启动我们的小型内部生产系统.它是完全自动化的,因此当我们检入代码更改时,我们将运行测试和其他验证步骤,最后自动部署新版本.

I have a Jenkins job which restarts our small in-house production system. It is fully automated, so when we check-in code changes, we run tests and other verification steps and finally automatically deploy the new version.

重新启动系统通常不是问题,因为它很快就会恢复运行,并且人们意识到有时会出现小故障.

It is usually not a problem restarting the system as it will be back shortly and people are aware that there might be a small outage now and then.

但是,在一天中,我知道系统使用率很高,因此希望防止任何自动重启.

However there are times during the day when I know that the system is heavily used and thus would like to prevent any automated restarts.

有没有办法做到这一点,例如配置作业根本不运行的时间表? IE.例如工作日从8到10"或任何其他基于Cron的时间表.

Is there a way to do this, e.g. configure a timeframe where a job is not running at all? I.e. something like "on weekdays from 8 to 10" or any other cron-based schedule.

我能想到的唯一选择是通过一些cli命令定期禁用和启用该作业,但希望有更好的方法来实现此目的.

The only option that I can think of is to periodically disable and enable the job via some cli-commands, but hopefully there is a better way to do this.

推荐答案

您可以使用

You can use the Conditional BuildStep plugin and set some timeframe where your job can be launched (or not).

类似的东西:

这篇关于如何阻止Jenkins作业在特定时间运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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