Spa*_*unk 11 jobs gitlab gitlab-ci
我在 gitlab 中有一个示例管道。如果任何作业失败,我希望管道停止。下面是用于复制该场景的代码。管道的状态确实显示失败,但即使在失败的阶段之后,作业也会继续运行。附图中的示例。
stages:
- unittest
- coverage_test
- static_code_analysis
variables:
skip_integration:
value: 'false'
description: "This variable for skipping integration tests"
skip_migration:
value: 'false'
unittest:
stage: unittest
script:
- echo "testing the code"
rules:
- if: '$CI_COMMIT_BRANCH == "master"'
when: always
- if: '$skip_integration == "true"'
when: never
- if: '$skip_integration == "false"'
when: always
lint_test:
stage: static_code_analysis
allow_failure: false
script:
- echo "this is a test"
rules:
- if: '$CI_COMMIT_BRANCH == "master"'
when: always
- if: '$skip_integration == "true"'
when: never
- if: '$skip_integration == "false"'
when: always
- when: on_success
coverage_test:
stage: coverage_test
script:
- echo00 "this is test again"
rules:
- if: '$CI_COMMIT_BRANCH == "master"'
when: always
- if: '$skip_integration == "true"'
when: never
- if: '$skip_integration == "false"'
when: always
- when: on_success
Run Code Online (Sandbox Code Playgroud)
但管道不会因故障而停止。
Kam*_*Cuk 23
Run Code Online (Sandbox Code Playgroud)when: always
顾名思义,始终运行作业。如果您想在上一阶段成功后运行该作业,请运行它on_success。全部更改always为on_success.
when: on_success
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
13395 次 |
| 最近记录: |