【发布时间】:2021-12-29 17:58:38
【问题描述】:
我正在尝试实现一个 gitlab ci 管道,只有在特定目录或其子目录中的文件发生更改时才会触发该管道。
stages:
# - pre
- triggers
.schema_trigger: &trigger_config
trigger:
include: pipeline/zone.gitlab-ci.yml
strategy: depend
#pre-stage:
# image: centos:7
# stage: pre
# script:
# - echo "This job ensures that when no migrations are added the pipeline is still successfull"
demo:
stage: triggers
variables:
SCHEMA: demo
<<: *trigger_config
only:
refs:
- merge_requests
changes:
- schemas/demo/**/*.{sql,env}
问题是当我创建一个新的合并请求而不更改模式/演示目录时,管道仍然运行。我尝试了一些配置但没有成功,包括添加 only:refs 子句,其唯一效果是创建分离的管道。
而且这个问题只出现在分支的第一个管道上,之后的所有提交都被正确评估并且不会运行。
我如何才能实现仅在目录中的文件更改时才运行管道的目标?
【问题讨论】:
标签: gitlab continuous-integration gitlab-ci pipeline