From b5d15595f83f0453b60009564a0f2cce452c44ad Mon Sep 17 00:00:00 2001 From: DeveloperDurp Date: Sat, 29 Jul 2023 12:38:06 +0000 Subject: [PATCH] Update 2 files - /job-templates.tpl.yml - /scripts/render-pipelines-branch.sh --- job-templates.tpl.yml | 12 ++++++++++++ scripts/render-pipelines-branch.sh | 13 +++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 scripts/render-pipelines-branch.sh diff --git a/job-templates.tpl.yml b/job-templates.tpl.yml index a225af1..0249f46 100644 --- a/job-templates.tpl.yml +++ b/job-templates.tpl.yml @@ -26,3 +26,15 @@ render-job-templates-yml: - templates/** - job-templates.yml - job-templates.tpl.yml + +render-pipelines-to-branch: + stage: render + image: "${CI_REGISTRY}/containerized-applications/ci-images/ci-scripts:1.0.2" + script: + - ./scripts/install-curl.sh + - ./scripts/install-git.sh + - ./scripts/install-yq.sh + - ./scripts/render-pipelines-branch.sh + - ./scripts/commit-and-push-changes.sh + rules: + - if: $CI_COMMIT_BRANCH =~ /^release*/ \ No newline at end of file diff --git a/scripts/render-pipelines-branch.sh b/scripts/render-pipelines-branch.sh new file mode 100644 index 0000000..b12bf51 --- /dev/null +++ b/scripts/render-pipelines-branch.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +#%%MULTILINE_YAML_START +#Replace main branch with current branch + +for file in pipelines/*.yml + do + sed -i "s;ref: 'main';ref: '$CI_COMMIT_BRANCH';g" ./$file +done + +for file in compliance/*.yml + do + sed -i "s;ref: 'main';ref: '$CI_COMMIT_BRANCH';g" ./$file +done