根据:
https://docs.gitlab.com/ee/ci/yaml/#onlychanges--exceptchanges
,可以列出所有子目录的通配符:
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}
- "**/*.json"
但是如果你想包含多个目录呢?假设我有这样一个文件夹结构:
server-a-files/**/*
server-b-files/**/*
server-c-files/**/*
等等,你喜欢这个工作吗?
docker build:
script: docker build -t my-image:$CI_COMMIT_REF_SLUG .
only:
refs:
- branches
changes:
- server-*-files/**/*
或者我需要这样做:
docker build:
script: docker build -t my-image:$CI_COMMIT_REF_SLUG .
only:
refs:
- branches
changes:
- server-{a,b,c}-files/**/*
谢谢