如何将CI/CD Gitlab管道中的工作延迟到一定时间?
使用 start_in:30分钟
可以延迟作业(例如,提交后的实时部署)。
htttps:// docs。 gitlab.com/ee/ci/jobs/job_control.html#run-a-job-ab-after-a-delay
问题:是否也可以创建延迟直到特定时间?
例如,部署被推迟到5A.M.吗?
类似 start_at:05:00
之类的东西?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以用a 。生成配置的作业可以计算当前时间和所需部署时间之间的时间,并将其嵌入到
start_in
参数的生成的配置中。例如:
请记住,您需要考虑跑步者使用的时区(或使用UTC时间计算)以获得准确的计算。
You could approximate this with a dynamic child pipeline. The job that generates the configuration can calculate how much time is inbetween the current time and the desired deploy time and embed that in the generated config for the
start_in
parameter.As an example:
Keep in mind that you will need to consider the timezone used by your runner (or calculate using UTC time) to get an accurate calculation.
您可能正在寻找的是 this 。
编辑:避免重复管道运行已记录在在这里。如果您标记部署,则可以构建这样的命令:
这将告诉您自上次标签以来是否有任何提交。这可能是要弄清楚的工作控制功能,是否再次运行。
What you are probably looking for is a scheduled pipeline. Scheduled pipelines benefit from execution based on cron clauses. You can limit the execution of your complete pipeline definition on a step by step basis like this.
EDIT: Avoiding duplicate pipeline runs has been documented here. If you tag your deployments you could build a command like this:
This will tell you if there are any commits since the last tag. This could be a Job Control feature to figure out, whether to run again or not.