debian-mirror-gitlab/lib/gitlab/ci/syntax_templates/Manual jobs example.gitlab-ci.yml
2021-03-08 18:12:59 +05:30

53 lines
1.4 KiB
YAML

#
# A manual job is a type of job that is not executed automatically and must be explicitly started by a user.
# To make a job manual, add when: manual to its configuration.
# For more information, see https://docs.gitlab.com/ee/ci/yaml/README.html#whenmanual
#
stages:
- build
- test
- deploy
build-job:
stage: build
script:
- echo "This job is not a manual job"
manual-build:
stage: build
script:
- echo "This manual job passes after you trigger it."
when: manual
manual-build-allowed-to-fail:
stage: build
script:
- echo "This manual job fails after you trigger it."
- echo "It is allowed to fail, so the pipeline does not fail.
when: manual
allow_failure: true # Default behavior
test-job:
stage: test
script:
- echo "This is a normal test job"
- echo "It runs when the when the build stage completes."
- echo "It does not need to wait for the manual jobs in the build stage to run."
manual-test-not-allowed-to-fail:
stage: test
script:
- echo "This manual job fails after you trigger it."
- echo "It is NOT allowed to fail, so the pipeline is marked as failed
- echo "when this job completes."
- exit 1
when: manual
allow_failure: false # Optional behavior
deploy-job:
stage: deploy
script:
- echo "This is a normal deploy job"
- echo "If a manual job that isn't allowed to fail ran in an earlier stage and failed,
- echo "this job does not run".