summaryrefslogtreecommitdiff
path: root/lib/gitlab/ci/syntax_templates/Manual jobs example.gitlab-ci.yml
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/ci/syntax_templates/Manual jobs example.gitlab-ci.yml')
-rw-r--r--lib/gitlab/ci/syntax_templates/Manual jobs example.gitlab-ci.yml53
1 files changed, 53 insertions, 0 deletions
diff --git a/lib/gitlab/ci/syntax_templates/Manual jobs example.gitlab-ci.yml b/lib/gitlab/ci/syntax_templates/Manual jobs example.gitlab-ci.yml
new file mode 100644
index 00000000000..5f27def74c9
--- /dev/null
+++ b/lib/gitlab/ci/syntax_templates/Manual jobs example.gitlab-ci.yml
@@ -0,0 +1,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".