但仅在有更改的情况下

但仅在有更改的情况下

本文介绍了Gitlab-CI,按计划运行,但仅在有更改的情况下的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想每天部署一次项目,但前提是必须进行更改.我每个月都有一个特定的小时可以部署,并且我对使用计划的管道触发和部署感到很满意.

I'd like to deploy my project once per day, but only if there have been changes.There is a specific hour each that I am able to deploy during and I am comfortable with using a scheduled pipeline to trigger and deploy.

但是,并非总是有需要部署的更改.理想情况下,如果自上次部署以来对代码库没有进行任何更改,则管道不会在这一天运行.

However, there aren't always changes that require deployment. Ideally, if there have been no changes to the code base since the last deployment, the pipeline wouldn't run that day.

有没有办法实现这种行为?

Is there any way to achieve this behaviour?

推荐答案

这类似于具有4年历史的功能请求 gitlab-org/gitlab-foss 问题19813

This is similar to a 4 years old feature request gitlab-org/gitlab-foss issue 19813

我不希望发生这种情况,我希望它仅在 src 文件夹更改时才能运行.
这可能吗?

I don't want this to happen, I want it to run only if the src folder changes.
Is this possible?

最近(2020年7月)的结论是使用 only:changes/除外:更改

The recent (July 2020) conclusion is to use only:changes/except:changes

示例:

  only:
    changes:
      - package.json
      - package-lock.json

警告,如 Matthijs Bierman 所述.Questions/63525941/gitlab-ci按计划运行,但仅在有变化的情况下/63565982?noredirect = 1#comment113608523_63565982>评论,并以在此处记录:

Warning, as noted by Matthijs Bierman in the comments, and as documented here:

这篇关于Gitlab-CI,按计划运行,但仅在有更改的情况下的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 05:48