Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
8d464ff1
Commit
8d464ff1
authored
Sep 13, 2021
by
Marcel Amirault
Committed by
Suzanne Selhorn
Sep 13, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update style of allow_failure keyword reference
parent
d8f7c412
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
20 deletions
+48
-20
doc/ci/yaml/index.md
doc/ci/yaml/index.md
+48
-20
No files found.
doc/ci/yaml/index.md
View file @
8d464ff1
...
@@ -1867,36 +1867,43 @@ In this example, only runners with *both* the `ruby` and `postgres` tags can run
...
@@ -1867,36 +1867,43 @@ In this example, only runners with *both* the `ruby` and `postgres` tags can run
### `allow_failure`
### `allow_failure`
Use
`allow_failure`
when you want to let a job fail without impacting the rest of the CI
Use
`allow_failure`
to determine whether a pipeline should continue running when a job fails.
suite. The default value is
`false`
, except for
[
manual
](
../jobs/job_control.md#create-a-job-that-must-be-run-manually
)
jobs that use
the
[
`when: manual`
](
#when
)
syntax.
In jobs that use
[
`rules:`
](
#rules
)
, all jobs default to
`allow_failure: false`
,
-
To let the pipeline continue running subsequent jobs, use
`allow_failure: true`
.
*including*
`when: manual`
jobs
.
-
To stop the pipeline from running subsequent jobs, use
`allow_failure: false`
.
When
`allow_failure`
is set to
`true`
and the job fails, the job shows an orange warning in the UI.
When
jobs are allowed to fail (
`allow_failure: true`
) an orange warning (
**{status_warning}**
)
However, the logical flow of the pipeline considers the job a
indicates that a job failed. However, the pipeline is successful and the associated commit
success/passed, and is not blocked
.
is marked as passed with no warnings
.
Assuming all other jobs are successful, the job's stage and its pipeline
This same warning is displayed when:
show the same orange warning. However, the associated commit is marked as
"passed", without warnings.
In the following example,
`job1`
and
`job2`
run in parallel. If
`job1`
-
All other jobs in the stage are successful.
fails, it doesn't stop the next stage from running, because it's marked with
-
All other jobs in the pipeline are successful.
`allow_failure: true`
:
The default value for
`allow_failure`
is:
-
`true`
for
[
manual jobs
](
../jobs/job_control.md#create-a-job-that-must-be-run-manually
)
.
-
`false`
for manual jobs that also use
[
`rules`
](
#rules
)
.
-
`false`
in all other cases.
**Keyword type**
: Job keyword. You can use it only as part of a job.
**Possible inputs**
:
`true`
or
`false`
.
**Example of `allow_failure`**
:
```
yaml
```
yaml
job1
:
job1
:
stage
:
test
stage
:
test
script
:
script
:
-
execute_script_that_will_fail
-
execute_script_1
allow_failure
:
true
job2
:
job2
:
stage
:
test
stage
:
test
script
:
script
:
-
execute_script_that_will_succeed
-
execute_script_2
allow_failure
:
true
job3
:
job3
:
stage
:
deploy
stage
:
deploy
...
@@ -1904,14 +1911,35 @@ job3:
...
@@ -1904,14 +1911,35 @@ job3:
-
deploy_to_staging
-
deploy_to_staging
```
```
In this example,
`job1`
and
`job2`
run in parallel:
-
If
`job1`
fails, jobs in the
`deploy`
stage do not start.
-
If
`job2`
fails, jobs in the
`deploy`
stage can still start.
**Additional details**
:
-
You can use
`allow_failure`
as a subkey of
[
`rules:`
](
#rulesallow_failure
)
.
-
You can use
`allow_failure: false`
with a manual job to create a
[
blocking manual job
](
../jobs/job_control.md#types-of-manual-jobs
)
.
A blocked pipeline does not run any jobs in later stages until the manual job
is started and completes successfully.
#### `allow_failure:exit_codes`
#### `allow_failure:exit_codes`
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/273157) in GitLab 13.8.
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/273157) in GitLab 13.8.
> - [Feature flag removed](https://gitlab.com/gitlab-org/gitlab/-/issues/292024) in GitLab 13.9.
> - [Feature flag removed](https://gitlab.com/gitlab-org/gitlab/-/issues/292024) in GitLab 13.9.
Use
`allow_failure:exit_codes`
to dynamically control if a job should be allowed
Use
`allow_failure:exit_codes`
to control when a job should be
to fail. You can list which exit codes are not considered failures. The job fails
allowed to fail. The job is
`allow_failure: true`
for any of the listed exit codes,
for any other exit code:
and
`allow_failure`
false for any other exit code.
**Keyword type**
: Job keyword. You can use it only as part of a job.
**Possible inputs**
:
-
A single exit code.
-
An array of exit codes.
**Example of `allow_failure`**
:
```
yaml
```
yaml
test_job_1
:
test_job_1
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment