From 422a0e1ec9635888d09acbefb71a70aa341d5d17 Mon Sep 17 00:00:00 2001 From: Giacomo Leidi Date: Wed, 11 Sep 2024 13:18:42 +0200 Subject: [PATCH] gocd: slfo-stagings: Fix osc staging plugin setup. --- gocd/slfo-stagings.gocd.yaml | 12 +++++++++++- gocd/slfo-stagings.gocd.yaml.erb | 12 +++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/gocd/slfo-stagings.gocd.yaml b/gocd/slfo-stagings.gocd.yaml index 01233fd3a..1b66197a9 100644 --- a/gocd/slfo-stagings.gocd.yaml +++ b/gocd/slfo-stagings.gocd.yaml @@ -44,14 +44,24 @@ pipelines: - script: |- set -eu export PYTHONPATH=$PWD/scripts + + ## Setup osc staging plugin + tempdir=$(mktemp -d) + mkdir -p $tempdir/.osc-plugins + ln -s $PWD/osc-staging.py $tempdir/.osc-plugins + ln -s $PWD/osclib $tempdir/.osc-plugins + export HOME=$tempdir + for letter in A B C D E F G H S V Y ; do ## if the staging was frozen today, skip it if ! osc -A $STAGING_API meta attribute "${SLFO_PROJECT}:Staging:${letter}" --attribute OSRT:FreezeTime | grep $(date +%Y-%m-%d); then osc -A $STAGING_API staging freeze -p $SLFO_PROJECT $letter else - echo Skipping "${SLFO_PROJECT}:Staging:${letter}" + echo "${SLFO_PROJECT}:Staging:${letter}" was frozen today, skipping it... fi done + ## Tear down osc staging plugin + rm -rf $tempdir SUSE.SLFO.Main.Staging.A: environment_variables: diff --git a/gocd/slfo-stagings.gocd.yaml.erb b/gocd/slfo-stagings.gocd.yaml.erb index 15b49c1b7..1d1401480 100644 --- a/gocd/slfo-stagings.gocd.yaml.erb +++ b/gocd/slfo-stagings.gocd.yaml.erb @@ -45,14 +45,24 @@ pipelines: - script: |- set -eu export PYTHONPATH=$PWD/scripts + + ## Setup osc staging plugin + tempdir=$(mktemp -d) + mkdir -p $tempdir/.osc-plugins + ln -s $PWD/osc-staging.py $tempdir/.osc-plugins + ln -s $PWD/osclib $tempdir/.osc-plugins + export HOME=$tempdir + for letter in <% stagings.each do |letter| %><%= letter %> <% end -%>; do ## if the staging was frozen today, skip it if ! osc -A $STAGING_API meta attribute "${SLFO_PROJECT}:Staging:${letter}" --attribute OSRT:FreezeTime | grep $(date +%Y-%m-%d); then osc -A $STAGING_API staging freeze -p $SLFO_PROJECT $letter else - echo Skipping "${SLFO_PROJECT}:Staging:${letter}" + echo "${SLFO_PROJECT}:Staging:${letter}" was frozen today, skipping it... fi done + ## Tear down osc staging plugin + rm -rf $tempdir <% stagings.each do |letter| %> SUSE.SLFO.Main.Staging.<%= letter %>: environment_variables: