Commit 4debfa65 authored by Suzanne Selhorn's avatar Suzanne Selhorn

Merge branch 'docs-update-stages-keyword' into 'master'

Update stages keyword to use new style

See merge request gitlab-org/gitlab!73903
parents 5c70072b 8efe5a95
...@@ -117,12 +117,10 @@ a job-specific `image:` section: ...@@ -117,12 +117,10 @@ a job-specific `image:` section:
### `stages` ### `stages`
Use `stages` to define stages that contain groups of jobs. `stages` is defined globally Use `stages` to define stages that contain groups of jobs. Use [`stage`](#stage)
for the pipeline. Use [`stage`](#stage) in a job to define which stage the job is in a job to configure the job to run in a specific stage.
part of.
If `stages` is not defined in the `.gitlab-ci.yml` file, then the default If `stages` is not defined in the `.gitlab-ci.yml` file, the default pipeline stages are:
pipeline stages are:
- [`.pre`](#stage-pre) - [`.pre`](#stage-pre)
- `build` - `build`
...@@ -130,12 +128,14 @@ pipeline stages are: ...@@ -130,12 +128,14 @@ pipeline stages are:
- `deploy` - `deploy`
- [`.post`](#stage-post) - [`.post`](#stage-post)
The order of the `stages` items defines the execution order for jobs: The order of the items in `stages` defines the execution order for jobs:
- Jobs in the same stage run in parallel. - Jobs in the same stage run in parallel.
- Jobs in the next stage run after the jobs from the previous stage complete successfully. - Jobs in the next stage run after the jobs from the previous stage complete successfully.
For example: **Keyword type**: Global keyword.
**Example of `stages`:**
```yaml ```yaml
stages: stages:
...@@ -144,6 +144,8 @@ stages: ...@@ -144,6 +144,8 @@ stages:
- deploy - deploy
``` ```
In this example:
1. All jobs in `build` execute in parallel. 1. All jobs in `build` execute in parallel.
1. If all jobs in `build` succeed, the `test` jobs execute in parallel. 1. If all jobs in `build` succeed, the `test` jobs execute in parallel.
1. If all jobs in `test` succeed, the `deploy` jobs execute in parallel. 1. If all jobs in `test` succeed, the `deploy` jobs execute in parallel.
...@@ -152,17 +154,17 @@ stages: ...@@ -152,17 +154,17 @@ stages:
If any job fails, the pipeline is marked as `failed` and jobs in later stages do not If any job fails, the pipeline is marked as `failed` and jobs in later stages do not
start. Jobs in the current stage are not stopped and continue to run. start. Jobs in the current stage are not stopped and continue to run.
If a job does not specify a [`stage`](#stage), the job is assigned the `test` stage. **Additional details**:
If a stage is defined, but no jobs use it, the stage is not visible in the pipeline. This is - If a job does not specify a [`stage`](#stage), the job is assigned the `test` stage.
useful for [compliance pipeline configuration](../../user/project/settings/index.md#compliance-pipeline-configuration) - If a stage is defined but no jobs use it, the stage is not visible in the pipeline,
because: which can help [compliance pipeline configurations](../../user/project/settings/index.md#compliance-pipeline-configuration):
- Stages can be defined in the compliance configuration but remain hidden if not used.
- The defined stages become visible when developers use them in job definitions.
- Stages can be defined in the compliance configuration but remain hidden if not used. **Related topics**:
- The defined stages become visible when developers use them in job definitions.
To make a job start earlier and ignore the stage order, use - To make a job start earlier and ignore the stage order, use the [`needs`](#needs) keyword.
the [`needs`](#needs) keyword.
### `workflow` ### `workflow`
......
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