summaryrefslogtreecommitdiff
path: root/lib/gitlab/ci/syntax_templates/Manual jobs example.gitlab-ci.yml
blob: 5f27def74c92437e81dd719f04c77b54bf4dc0b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#
# 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".