diff options
Diffstat (limited to 'doc/ci/yaml/README.md')
-rw-r--r-- | doc/ci/yaml/README.md | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/doc/ci/yaml/README.md b/doc/ci/yaml/README.md index 984878b6c9b..31f99cd5e68 100644 --- a/doc/ci/yaml/README.md +++ b/doc/ci/yaml/README.md @@ -96,9 +96,9 @@ This can be an array or a multi-line string. jobs, including failed ones. This has to be an array or a multi-line string. The `before_script` and the main `script` are concatenated and run in a single context/container. -The `after_script` is run separately, so depending on the executor, changes done -outside of the working tree might not be visible, e.g. software installed in the -`before_script`. +The `after_script` is run separately. The current working directory is set back to +default. Depending on the executor, changes done outside of the working tree might +not be visible, e.g. software installed in the `before_script`. It's possible to overwrite the globally defined `before_script` and `after_script` if you set it per-job: @@ -423,10 +423,28 @@ connected with merge requests yet, and because GitLab is creating pipelines before an user can create a merge request we don't know a target branch at this point. -Without a target branch, it is not possible to know what the common ancestor is, -thus we always create a job in that case. This feature works best for stable -branches like `master` because in that case GitLab uses the previous commit -that is present in a branch to compare against the latest SHA that was pushed. +#### Using `changes` with `merge_requests` + +With [pipelines for merge requests](../merge_request_pipelines/index.md), +make it possible to define if a job should be created base on files modified +in a merge request. + +For example: + +``` +docker build service one: + script: docker build -t my-service-one-image:$CI_COMMIT_REF_SLUG . + only: + refs: + - merge_requests + changes: + - Dockerfile + - service-one/**/* +``` + +In the scenario above, if you create or update a merge request that changes +either files in `service-one` folder or `Dockerfile`, GitLab creates and triggers +the `docker build service one` job. ## `tags` |