summaryrefslogtreecommitdiff
path: root/lib/gitlab/ci/syntax_templates/Before_script and after_script example.gitlab-ci.yml
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/ci/syntax_templates/Before_script and after_script example.gitlab-ci.yml')
-rw-r--r--lib/gitlab/ci/syntax_templates/Before_script and after_script example.gitlab-ci.yml36
1 files changed, 36 insertions, 0 deletions
diff --git a/lib/gitlab/ci/syntax_templates/Before_script and after_script example.gitlab-ci.yml b/lib/gitlab/ci/syntax_templates/Before_script and after_script example.gitlab-ci.yml
new file mode 100644
index 00000000000..382bac09ed7
--- /dev/null
+++ b/lib/gitlab/ci/syntax_templates/Before_script and after_script example.gitlab-ci.yml
@@ -0,0 +1,36 @@
+#
+# You can define common tasks and run them before or after the main scripts in jobs.
+# For more information, see:
+# - https://docs.gitlab.com/ee/ci/yaml/README.html#before_script
+# - https://docs.gitlab.com/ee/ci/yaml/README.html#after_script
+#
+
+stages:
+ - test
+
+default:
+ before_script:
+ - echo "This script runs before the main script in every job, unless the job overrides it."
+ - echo "It may set up common dependencies, for example."
+ after_script:
+ - echo "This script runs after the main script in every job, unless the job overrides it."
+ - echo "It may do some common final clean up tasks"
+
+job-standard:
+ stage: test
+ script:
+ - echo "This job uses both of the globally defined before and after scripts."
+
+job-override-before:
+ stage: test
+ before_script:
+ - echo "Use a different before_script in this job."
+ script:
+ - echo "This job uses its own before_script, and the global after_script."
+
+job-override-after:
+ stage: test
+ after_script:
+ - echo "Use a different after_script in this job."
+ script:
+ - echo "This job uses its own after_script, and the global before_script."