Continuous integration 如何在文件更改时触发特定的gitlab ci/cd作业
我的文件层次结构如下所示Continuous integration 如何在文件更改时触发特定的gitlab ci/cd作业,continuous-integration,gitlab,continuous-deployment,Continuous Integration,Gitlab,Continuous Deployment,我的文件层次结构如下所示 / run_docker.sh Dockerfile .gitlab-ci.yml my.gitlab ci.yml的内容如下 stages: - run_script - build_image run_script: stage: run_script script: - echo "script is running" build_image: stage: run_docker script: - echo "buil
/
run_docker.sh
Dockerfile
.gitlab-ci.yml
my.gitlab ci.yml
的内容如下
stages:
- run_script
- build_image
run_script:
stage: run_script
script:
- echo "script is running"
build_image:
stage: run_docker
script:
- echo "building image"
这些script
标记是我在这里放的一些示例(不是实际值),我想要的是,当我只更改Dockerfile
时,我只需要触发build\u image
作业,它不应该触发build\u image
作业
我如何才能做到这一点?我有一个类似的场景,我最终使用了以下条件:
only:
variables:
- $CI_COMMIT_MESSAGE =~ /docker/
这并不完全是你想要的,但它可以完成任务。每当我需要触发docker映像构建作业时,我都会在提交消息中提到
[docker]
。有人帮我吗?