From 99a7e58dae65e1d1077b498d6bf8e00016930263 Mon Sep 17 00:00:00 2001 From: Pierre Smeyers <pierre.smeyers@gmail.com> Date: Wed, 18 May 2022 18:47:20 +0200 Subject: [PATCH] feat: add extract-script job template --- templates/extract.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 templates/extract.yml diff --git a/templates/extract.yml b/templates/extract.yml new file mode 100644 index 0000000..378def0 --- /dev/null +++ b/templates/extract.yml @@ -0,0 +1,20 @@ +# this job extracts the bash script from the given template(s) +extract-script: + image: alpine + stage: .pre + script: + - echo "#!/bin/bash" > script.sh + - sed -n '/BEGSCRIPT/,/ENDSCRIPT/p' "$GITLAB_CI_FILES" | sed 's/^ //' >> script.sh + - export LC_ALL=C.UTF-8 + artifacts: + when: always + name: extracted template script + expire_in: 1h + paths: + - script.sh + rules: + # exclude merge requests + - if: $CI_MERGE_REQUEST_ID + when: never + # enabled if $GITLAB_CI_FILES is set + - if: $GITLAB_CI_FILES -- GitLab