4
Gitlab-CI 中 only 关键字怎么使用
source link: https://www.v2ex.com/t/786400
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
期望是:在 master
分支中的 Dockerfile,requirements.txt ,.gitlab-ci.yml
3 个文件中只要有一个发生变化时,就触发 build
这个 stage
但根据以下配置,目前实际触发情况是,所有分支都跑这了个 stage
,而且所有提交都触发,看上去这个 only
压根是没有生效,不知道是配置有误还是怎么的,官方文档也是这么配置的,大家帮忙看一下是哪里的问题
# ..gitlab-ci.yml
.main:
image: base:latest
stages:
- build
build_image:
stage: build
tags:
- tag
extends: .main
script:
- docker build -t test:stable .
only:
refs:
- master
changes:
- Dockerfile
- requirements.txt
- .gitlab-ci.yml
来自官方文档: https://docs.gitlab.com/ee/ci/yaml/#only--except
docker build:
script: docker build -t my-image:$CI_COMMIT_REF_SLUG .
only:
refs:
- branches
changes:
- Dockerfile
- docker/scripts/*
- dockerfiles/**/*
- more_scripts/*.{rb,py,sh}
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK