slfo-stagings: add a timeout for Build.product, and do not run if repo is missing

Ensure that the 'product' repo is configured in the project meta.

Unfortunately, since we're checking in the configuration of the staging
itself, rather than the parent project's, there are increased changes of
some human/tooling error that might drop the repository from the
configuration. This will make the job run an endless loop.

Also, add a timeout for 180 minutes for the job. It is enough for
the product build process, and if it isn't, it's better to cancel
and have human eyes looking at it.

Signed-off-by: Eugenio Paolantonio <eugenio.paolantonio@suse.com>
This commit is contained in:
Eugenio Paolantonio 2024-06-17 16:24:01 +02:00
parent 0cc8a43ba1
commit 41c61c3ebf
2 changed files with 72 additions and 12 deletions

View File

@ -59,13 +59,18 @@ pipelines:
fi
- Build.product:
timeout: 180
resources:
- staging-bot
tasks:
- script: |-
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; do
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
fi
sleep 60
done
@ -138,13 +143,18 @@ pipelines:
fi
- Build.product:
timeout: 180
resources:
- staging-bot
tasks:
- script: |-
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; do
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
fi
sleep 60
done
@ -217,13 +227,18 @@ pipelines:
fi
- Build.product:
timeout: 180
resources:
- staging-bot
tasks:
- script: |-
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; do
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
fi
sleep 60
done
@ -296,13 +311,18 @@ pipelines:
fi
- Build.product:
timeout: 180
resources:
- staging-bot
tasks:
- script: |-
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; do
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
fi
sleep 60
done
@ -375,13 +395,18 @@ pipelines:
fi
- Build.product:
timeout: 180
resources:
- staging-bot
tasks:
- script: |-
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; do
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
fi
sleep 60
done
@ -454,13 +479,18 @@ pipelines:
fi
- Build.product:
timeout: 180
resources:
- staging-bot
tasks:
- script: |-
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; do
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
fi
sleep 60
done
@ -533,13 +563,18 @@ pipelines:
fi
- Build.product:
timeout: 180
resources:
- staging-bot
tasks:
- script: |-
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; do
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
fi
sleep 60
done
@ -612,13 +647,18 @@ pipelines:
fi
- Build.product:
timeout: 180
resources:
- staging-bot
tasks:
- script: |-
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; do
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
fi
sleep 60
done
@ -691,13 +731,18 @@ pipelines:
fi
- Build.product:
timeout: 180
resources:
- staging-bot
tasks:
- script: |-
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; do
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
fi
sleep 60
done
@ -770,13 +815,18 @@ pipelines:
fi
- Build.product:
timeout: 180
resources:
- staging-bot
tasks:
- script: |-
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; do
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
fi
sleep 60
done
@ -849,13 +899,18 @@ pipelines:
fi
- Build.product:
timeout: 180
resources:
- staging-bot
tasks:
- script: |-
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; do
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
fi
sleep 60
done

View File

@ -60,13 +60,18 @@ pipelines:
fi
- Build.product:
timeout: 180
resources:
- staging-bot
tasks:
- script: |-
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; do
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
fi
sleep 60
done