2024-05-20 09:51:53 +02:00
---
format_version: 3
pipelines:
2024-09-16 15:26:25 +02:00
<% stagings = %w(A B C D E F G H S V Y) -%>
2024-08-26 14:43:14 +02:00
SUSE.SLFO.Main.Staging.Weekly.Freeze:
environment_variables:
SLFO_PROJECT: SUSE:SLFO:Main
SLFO_RING_1_PROJECT: SUSE:SLFO:Main:Staging:Rings:1-MinimalX
STAGING_API: https://api.suse.de
2024-09-04 17:11:32 +02:00
OSC_CONFIG: /home/go/config/oscrc-staging-bot
2024-08-26 14:43:14 +02:00
group: SLFO.Stagings
lock_behavior: unlockWhenFinished
timer:
2024-08-30 10:09:47 +02:00
spec: "0 0 0-23 ? * SUN"
2024-08-26 14:43:14 +02:00
materials:
scripts:
auto_update: true
git: https://github.com/openSUSE/openSUSE-release-tools.git
whitelist:
- DO_NOT_TRIGGER
stages:
- Check.Ring.1.Finished:
timeout: 50
resources:
- staging-bot
tasks:
- script: |-
2024-09-04 15:45:24 +02:00
set -eu
status="$(osc -A $STAGING_API api /build/$SLFO_RING_1_PROJECT/standard/x86_64?view=status | grep 'code=' | sed -E 's/^.*code="(.*)".*$/\1/')"
echo $SLFO_RING_1_PROJECT status: "${status}"
2024-09-06 15:47:26 +02:00
if printf '%s' "${status}" | grep -q finished; then
2024-09-04 15:45:24 +02:00
exit 0
else
exit 1
fi
2024-08-26 14:43:14 +02:00
- Freeze.stagings:
2024-08-30 10:09:47 +02:00
## 6 hours (at most 30 minutes per staging)
2024-08-26 14:43:14 +02:00
timeout: 360
resources:
- staging-bot
tasks:
- script: |-
set -eu
2024-09-16 12:08:00 +02:00
export PYTHONPATH=$PWD
2024-09-11 13:18:42 +02:00
## 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
2024-08-26 14:43:14 +02:00
for letter in <% stagings.each do |letter| %><%= letter %> <% end -%>; do
2024-08-30 10:09:47 +02:00
## if the staging was frozen today, skip it
2024-08-26 14:43:14 +02:00
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
2024-09-11 13:18:42 +02:00
echo "${SLFO_PROJECT}:Staging:${letter}" was frozen today, skipping it...
2024-08-26 14:43:14 +02:00
fi
done
2024-09-11 13:18:42 +02:00
## Tear down osc staging plugin
rm -rf $tempdir
2024-05-20 09:51:53 +02:00
<% stagings.each do |letter| %>
SUSE.SLFO.Main.Staging.<%= letter %>:
environment_variables:
STAGING_PROJECT: SUSE:SLFO:Main:Staging:<%= letter %>
STAGING_API: https://api.suse.de
OSC_CONFIG: /home/go/config/oscrc-staging-bot
group: SLFO.Stagings
lock_behavior: unlockWhenFinished
materials:
stagings:
git: git://botmaster.suse.de/suse-repos.git
auto_update: true
destination: repos
whitelist:
- SUSE:SLFO:Main:Staging:<%= letter %>_-_standard.yaml
scripts:
auto_update: true
2024-06-11 15:44:39 +02:00
git: https://github.com/openSUSE/openSUSE-release-tools.git
2024-05-20 09:51:53 +02:00
whitelist:
- DO_NOT_TRIGGER
destination: scripts
stages:
- Checks:
jobs:
Check.Build.Succeeds:
resources:
- staging-bot
tasks:
- script: |-
export PYTHONPATH=$PWD/scripts
cd scripts/gocd
./report-status.py -A $STAGING_API -p $STAGING_PROJECT -n packagelists -r standard -s pending
./verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard
Repo.Checker:
environment_variables:
OSC_CONFIG: /home/go/config/oscrc-staging-bot
resources:
- repo-checker
tasks:
- script: |-
./scripts/staging-installcheck.py -A $STAGING_API -p SUSE:SLFO:Main -s $STAGING_PROJECT
- Update.000product:
resources:
- repo-checker
tasks:
- script: |-
export PYTHONPATH=$PWD/scripts
cd scripts/gocd
2024-05-30 10:05:37 +02:00
if ../pkglistgen.py --debug -A $STAGING_API update_and_solve --engine product_composer --staging $STAGING_PROJECT --force; then
2024-05-20 09:51:53 +02:00
./report-status.py -A $STAGING_API -p $STAGING_PROJECT -n packagelists -r standard -s success
else
./report-status.py -A $STAGING_API -p $STAGING_PROJECT -n packagelists -r standard -s failure
exit 1
fi
2024-09-16 15:26:25 +02:00
- Build.product:
timeout: 180
resources:
- staging-bot
tasks:
- script: |-
2024-11-07 14:29:12 +01:00
minutes=0
2024-09-16 15:26:25 +02:00
osc -A $STAGING_API api -X POST "/source/$STAGING_PROJECT?cmd=remove_flag&repository=product&flag=build"
export PYTHONPATH=$PWD/scripts
while ./scripts/gocd/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r product; ret=$?; [ ${ret} -ne 0 ]; do
if [ ${ret} -eq 2 ]; then
echo "product repository not found. Project configuration issue?" >&2
exit 1
2024-11-07 14:29:12 +01:00
elif [ ${minutes} -gt 180 ]; then
echo "Product is still failing after timeout, exiting..." >&2
exit 1
2024-09-16 15:26:25 +02:00
fi
sleep 60
2024-11-07 14:29:12 +01:00
minutes=$(expr $minutes + 1)
2024-09-16 15:26:25 +02:00
done
- Enable.images.repo:
resources:
- staging-bot
tasks:
- script: |-
osc -A $STAGING_API api -X POST "/source/$STAGING_PROJECT?cmd=remove_flag&repository=images&flag=build"
export PYTHONPATH=$PWD/scripts
while osc -A $STAGING_API api "/build/$STAGING_PROJECT/_result?view=summary&repository=images" | grep 'dirty=.true.'; do
sleep 60
done
./scripts/gocd/report-status.py -A $STAGING_API -p $STAGING_PROJECT -n images:enabled -r standard -s success
<% end -%>
<% stagings = %w(A B C D E F G H S V Y) -%>
SUSE.SLFO.1.1.Staging.Weekly.Freeze:
environment_variables:
SLFO_1_1_PROJECT: SUSE:SLFO:1.1
SLFO_1_1_RING_1_PROJECT: SUSE:SLFO:1.1:Staging:Rings:1-MinimalX
STAGING_API: https://api.suse.de
OSC_CONFIG: /home/go/config/oscrc-staging-bot
group: SLFO.1.1.Stagings
lock_behavior: unlockWhenFinished
timer:
spec: "0 0 0-23 ? * SUN"
materials:
scripts:
auto_update: true
git: https://github.com/openSUSE/openSUSE-release-tools.git
whitelist:
- DO_NOT_TRIGGER
stages:
- Check.Ring.1.Finished:
timeout: 50
resources:
- staging-bot
tasks:
- script: |-
set -eu
status="$(osc -A $STAGING_API api /build/$SLFO_1_1_RING_1_PROJECT/standard/x86_64?view=status | grep 'code=' | sed -E 's/^.*code="(.*)".*$/\1/')"
echo $SLFO_1_1_RING_1_PROJECT status: "${status}"
if printf '%s' "${status}" | grep -q finished; then
exit 0
else
exit 1
fi
- Freeze.stagings:
## 6 hours (at most 30 minutes per staging)
timeout: 360
resources:
- staging-bot
tasks:
- script: |-
set -eu
export PYTHONPATH=$PWD
## 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_1_1_PROJECT}:Staging:${letter}" --attribute OSRT:FreezeTime | grep $(date +%Y-%m-%d); then
osc -A $STAGING_API staging freeze -p $SLFO_1_1_PROJECT $letter
else
echo "${SLFO_1_1_PROJECT}:Staging:${letter}" was frozen today, skipping it...
fi
done
## Tear down osc staging plugin
rm -rf $tempdir
<% stagings.each do |letter| %>
SUSE.SLFO.1.1.Staging.<%= letter %>:
environment_variables:
SLFO_1_1_PROJECT: SUSE:SLFO:1.1
STAGING_PROJECT: SUSE:SLFO:1.1:Staging:<%= letter %>
STAGING_API: https://api.suse.de
OSC_CONFIG: /home/go/config/oscrc-staging-bot
group: SLFO.1.1.Stagings
lock_behavior: unlockWhenFinished
materials:
stagings:
git: git://botmaster.suse.de/suse-repos.git
auto_update: true
destination: repos
whitelist:
- SUSE:SLFO:1.1:Staging:<%= letter %>_-_standard.yaml
scripts:
auto_update: true
git: https://github.com/openSUSE/openSUSE-release-tools.git
whitelist:
- DO_NOT_TRIGGER
destination: scripts
stages:
- Checks:
jobs:
Check.Build.Succeeds:
resources:
- staging-bot
tasks:
- script: |-
export PYTHONPATH=$PWD/scripts
cd scripts/gocd
./report-status.py -A $STAGING_API -p $STAGING_PROJECT -n packagelists -r standard -s pending
./verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard
Repo.Checker:
environment_variables:
OSC_CONFIG: /home/go/config/oscrc-staging-bot
resources:
- repo-checker
tasks:
- script: |-
./scripts/staging-installcheck.py -A $STAGING_API -p $SLFO_1_1_PROJECT -s $STAGING_PROJECT
- Update.000product:
resources:
- repo-checker
tasks:
- script: |-
export PYTHONPATH=$PWD/scripts
cd scripts/gocd
if ../pkglistgen.py --debug -A $STAGING_API update_and_solve --engine product_composer --staging $STAGING_PROJECT --force; then
./report-status.py -A $STAGING_API -p $STAGING_PROJECT -n packagelists -r standard -s success
else
./report-status.py -A $STAGING_API -p $STAGING_PROJECT -n packagelists -r standard -s failure
exit 1
fi
2024-06-11 10:57:50 +02:00
- Build.product:
2024-06-17 16:24:01 +02:00
timeout: 180
2024-06-11 10:57:50 +02:00
resources:
- staging-bot
tasks:
- script: |-
2024-11-12 12:32:32 +01:00
minutes=1
2024-06-11 10:57:50 +02:00
osc -A $STAGING_API api -X POST "/source/$STAGING_PROJECT?cmd=remove_flag&repository=product&flag=build"
export PYTHONPATH=$PWD/scripts
2024-11-12 12:32:32 +01:00
# Let the scheduler warm up first
sleep 60
while osc -A $STAGING_API api -X GET "/build/$STAGING_PROJECT/_result?view=summary&repository=product&arch=local" | grep -E 'statuscount code="(blocked|scheduled|building)"'; do
if [ ${minutes} -gt 180 ]; then
echo "Product is still building after timeout, exiting..." >&2
2024-11-07 14:29:12 +01:00
exit 1
2024-06-17 16:24:01 +02:00
fi
2024-06-11 10:57:50 +02:00
sleep 60
2024-11-07 14:29:12 +01:00
minutes=$(expr $minutes + 1)
2024-06-11 10:57:50 +02:00
done
2024-11-12 12:32:32 +01:00
# Always fail on broken/failed products
if osc -A $STAGING_API api -X GET "/build/$STAGING_PROJECT/_result?view=summary&repository=product&arch=local" | grep -qE 'statuscount code="(broken|failed)"'; then
echo "Some products failed to build, exiting..." >&2
exit 1
fi
2024-06-11 10:57:50 +02:00
2024-05-20 09:51:53 +02:00
- Enable.images.repo:
resources:
- staging-bot
tasks:
- script: |-
osc -A $STAGING_API api -X POST "/source/$STAGING_PROJECT?cmd=remove_flag&repository=images&flag=build"
export PYTHONPATH=$PWD/scripts
while osc -A $STAGING_API api "/build/$STAGING_PROJECT/_result?view=summary&repository=images" | grep 'dirty=.true.'; do
sleep 60
done
./scripts/gocd/report-status.py -A $STAGING_API -p $STAGING_PROJECT -n images:enabled -r standard -s success
<% end -%>