Commit e1082ea3 authored by Nathan Friend's avatar Nathan Friend

Update all only: and except: to take arrays

This commit updates all instances in the documentation where we
reference only: or except: to ensure they show the setting accepting an
array (as opposed to a single value).

Only/except do not support single values (i.e. `only: merge_requests`
is invalid).
parent e720dcd0
...@@ -228,5 +228,5 @@ our very powerful [`only/except` rules system](../yaml/README.md#onlyexcept-basi ...@@ -228,5 +228,5 @@ our very powerful [`only/except` rules system](../yaml/README.md#onlyexcept-basi
```yaml ```yaml
my_job: my_job:
only: branches only: [branches]
``` ```
...@@ -30,7 +30,7 @@ Pipelines for merge requests have the following requirements and limitations: ...@@ -30,7 +30,7 @@ Pipelines for merge requests have the following requirements and limitations:
## Configuring pipelines for merge requests ## Configuring pipelines for merge requests
To configure pipelines for merge requests, add the `only: merge_requests` parameter to To configure pipelines for merge requests, add the `only: [merge_requests]` parameter to
the jobs that you want to run only for merge requests. the jobs that you want to run only for merge requests.
Then, when developers create or update merge requests, a pipeline runs Then, when developers create or update merge requests, a pipeline runs
...@@ -68,7 +68,7 @@ After the merge request is updated with new commits: ...@@ -68,7 +68,7 @@ After the merge request is updated with new commits:
- The pipeline fetches the latest code from the source branch and run tests against it. - The pipeline fetches the latest code from the source branch and run tests against it.
In the above example, the pipeline contains only a `test` job. In the above example, the pipeline contains only a `test` job.
Since the `build` and `deploy` jobs don't have the `only: merge_requests` parameter, Since the `build` and `deploy` jobs don't have the `only: [merge_requests]` parameter,
they will not run in the merge request. they will not run in the merge request.
Pipelines tagged with the **detached** badge indicate that they were triggered Pipelines tagged with the **detached** badge indicate that they were triggered
...@@ -86,7 +86,7 @@ Read the [documentation on Merge Trains](pipelines_for_merged_results/merge_trai ...@@ -86,7 +86,7 @@ Read the [documentation on Merge Trains](pipelines_for_merged_results/merge_trai
## Excluding certain jobs ## Excluding certain jobs
The behavior of the `only: merge_requests` parameter is such that _only_ jobs with The behavior of the `only: [merge_requests]` parameter is such that _only_ jobs with
that parameter are run in the context of a merge request; no other jobs will be run. that parameter are run in the context of a merge request; no other jobs will be run.
However, you may want to reverse this behavior, having all of your jobs to run _except_ However, you may want to reverse this behavior, having all of your jobs to run _except_
......
...@@ -780,7 +780,7 @@ it is possible to define a job to be created based on files modified ...@@ -780,7 +780,7 @@ it is possible to define a job to be created based on files modified
in a merge request. in a merge request.
In order to deduce the correct base SHA of the source branch, we recommend combining In order to deduce the correct base SHA of the source branch, we recommend combining
this keyword with `only: merge_requests`. This way, file differences are correctly this keyword with `only: [merge_requests]`. This way, file differences are correctly
calculated from any further commits, thus all changes in the merge requests are properly calculated from any further commits, thus all changes in the merge requests are properly
tested in pipelines. tested in pipelines.
...@@ -802,7 +802,7 @@ either files in `service-one` directory or the `Dockerfile`, GitLab creates ...@@ -802,7 +802,7 @@ either files in `service-one` directory or the `Dockerfile`, GitLab creates
and triggers the `docker build service one` job. and triggers the `docker build service one` job.
Note that if [pipelines for merge requests](../merge_request_pipelines/index.md) is Note that if [pipelines for merge requests](../merge_request_pipelines/index.md) is
combined with `only: change`, but `only: merge_requests` is omitted, there could be combined with `only: [change]`, but `only: [merge_requests]` is omitted, there could be
unwanted behavior. unwanted behavior.
For example: For example:
......
...@@ -699,7 +699,7 @@ nicely on different mobile devices. ...@@ -699,7 +699,7 @@ nicely on different mobile devices.
## Code blocks ## Code blocks
- Always wrap code added to a sentence in inline code blocks (`` ` ``). - Always wrap code added to a sentence in inline code blocks (`` ` ``).
E.g., `.gitlab-ci.yml`, `git add .`, `CODEOWNERS`, `only: master`. E.g., `.gitlab-ci.yml`, `git add .`, `CODEOWNERS`, `only: [master]`.
File names, commands, entries, and anything that refers to code should be added to code blocks. File names, commands, entries, and anything that refers to code should be added to code blocks.
To make things easier for the user, always add a full code block for things that can be To make things easier for the user, always add a full code block for things that can be
useful to copy and paste, as they can easily do it with the button on code blocks. useful to copy and paste, as they can easily do it with the button on code blocks.
......
...@@ -69,7 +69,7 @@ For example, to that on merge requests there is always a passing job even though ...@@ -69,7 +69,7 @@ For example, to that on merge requests there is always a passing job even though
```yaml ```yaml
enable_merge: enable_merge:
only: merge_requests only: [merge_requests]
script: script:
- echo true - echo true
``` ```
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment