openSUSE-release-tools/gocd/sp.target.gocd.yaml
Eugenio Paolantonio 330aa29413 gocd: sp/micro-targets: ensure the pipeline exits on failures
This was already implemented in ddd2304022e313eca9b391a043b12ecb9afe3bf7
for SLE GA to TEST, but missing in Micro and on the TEST -> PUBLISH leg
in SLE.

Releasing from TEST to PUBLISH might still fail for various reasons.
If it happens, ensure the pipeline exits early with non-zero exit code.

Signed-off-by: Eugenio Paolantonio <eugenio.paolantonio@suse.com>
2024-03-15 12:19:59 +01:00

91 lines
4.4 KiB
YAML

format_version: 3
pipelines:
SLE15.SP6.Images:
group: SLE15.Target
lock_behavior: unlockWhenFinished
materials:
repos:
git: git://botmaster.suse.de/suse-repos.git
auto_update: true
whitelist:
- SUSE:SLE-15-SP6:GA_-_images.yaml
destination: repos
scripts:
auto_update: true
git: https://github.com/openSUSE/openSUSE-release-tools.git
whitelist:
- DO_NOT_TRIGGER
destination: scripts
environment_variables:
OSC_CONFIG: /home/go/config/oscrc-staging-bot
stages:
- Expect.Images.To.Finish:
resources:
- staging-bot
tasks:
- script: |
export PYTHONPATH=scripts
set -e
./scripts/gocd/verify-repo-built-successful.py -A https://api.suse.de -p SUSE:SLE-15-SP6:GA -r containerfile
./scripts/gocd/verify-repo-built-successful.py -A https://api.suse.de -p SUSE:SLE-15-SP6:GA -r images
- Release.Images.To.Test:
approval: manual
roles:
- SLE
environment_variables:
OSC_CONFIG: /home/go/config/oscrc-totest-manager
resources:
- staging-bot
tasks:
- script: |-
set -e
CONTAINERS=$(osc -A https://api.suse.de ls SUSE:SLE-15-SP6:GA | grep "^\(cdi\|virt\)-.*-container")
for container in $CONTAINERS; do
osc -A https://api.suse.de release --target-project=SUSE:SLE-15-SP6:GA:TEST --target-repository=containers -r containerfile SUSE:SLE-15-SP6:GA $container
done
osc -A https://api.suse.de release --target-project=SUSE:SLE-15-SP6:GA:TEST --target-repository=containers -r images SUSE:SLE-15-SP6:GA sles15-image
PRODUCTS=$(osc -A https://api.suse.de ls SUSE:SLE-15-SP6:GA | grep "^SLES15-SP6" | grep -v release | grep -v : ||:)
if [ -z "${PRODUCTS}" ]; then
echo "[WARNNING] There is no cloud image to be released"
fi
for product in kiwi-templates-Minimal kiwi-templates-Minimal-s390x 000product $PRODUCTS; do
osc -A https://api.suse.de release SUSE:SLE-15-SP6:GA $product
done
sleep 600
while (osc -A https://api.suse.de/ api "/build/SUSE:SLE-15-SP6:GA:TEST/_result?view=summary&repository=containers" | grep "result project" | grep -v 'code="published" state="published">'); do
echo PENDING
sleep 600
done
osc -A https://api.suse.de/ api "/build/SUSE:SLE-15-SP6:GA:TEST/_result?view=summary&repository=containers" | grep "result project" | grep 'code="published" state="published">' && echo PUBLISHED
while (osc -A https://api.suse.de/ api "/build/SUSE:SLE-15-SP6:GA:TEST/_result?view=summary&repository=images" | grep "result project" | grep -v 'code="published" state="published">'); do
echo PENDING
sleep 600
done
osc -A https://api.suse.de/ api "/build/SUSE:SLE-15-SP6:GA:TEST/_result?view=summary&repository=images" | grep "result project" | grep 'code="published" state="published">' && echo PUBLISHED
- Release.Images.To.Publish:
approval: manual
roles:
- SLE
environment_variables:
OSC_CONFIG: /home/go/config/oscrc-totest-manager
resources:
- staging-bot
tasks:
- script: |-
set -e
osc -A https://api.suse.de release SUSE:SLE-15-SP6:GA:TEST
sleep 600
while (osc -A https://api.suse.de/ api "/build/SUSE:SLE-15-SP6:GA:PUBLISH/_result?view=summary&repository=containers" | grep "result project" | grep -v 'code="published" state="published">'); do
echo PENDING
sleep 600
done
osc -A https://api.suse.de/ api "/build/SUSE:SLE-15-SP6:GA:PUBLISH/_result?view=summary&repository=containers" | grep "result project" | grep 'code="published" state="published">' && echo PUBLISHED
while (osc -A https://api.suse.de/ api "/build/SUSE:SLE-15-SP6:GA:PUBLISH/_result?view=summary&repository=images" | grep "result project" | grep -v 'code="published" state="published">'); do
echo PENDING
sleep 600
done
osc -A https://api.suse.de/ api "/build/SUSE:SLE-15-SP6:GA:PUBLISH/_result?view=summary&repository=images" | grep "result project" | grep 'code="published" state="published">' && echo PUBLISHED