'Is it possible to only trigger a Pipeline if certain files are changed?
I have a project with a working GitLab-CI configuration, but I only want to create and execute a pipeline, when one of my config files are changed. Is there a way to check for changed files within the gitlab-ci.yml and only execute, when specified files are changed?
Solution 1:[1]
Yes, using changes
: add or exclude jobs from a pipeline based on what files are changed. Same as only:changes
.
https://docs.gitlab.com/ee/ci/yaml/#onlychangesexceptchanges
Warning: If using only:changes with only allow merge requests to be merged if the pipeline succeeds, undesired behavior could result if you don’t also use only:merge_requests.
Also, it's always evaluates as “true” in Scheduled pipelines. All files are considered to have “changed” when a scheduled pipeline runs.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Iron Bishop |