From d886e98724f403c377ceb4219bb978ef15606217 Mon Sep 17 00:00:00 2001 From: Eugenio Paolantonio Date: Mon, 17 Jun 2024 16:15:17 +0200 Subject: [PATCH 1/4] verify-repo-built-successful: mark project and repository args required The script expects those to be set. Signed-off-by: Eugenio Paolantonio --- gocd/verify-repo-built-successful.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gocd/verify-repo-built-successful.py b/gocd/verify-repo-built-successful.py index b00e9483..dda16c26 100755 --- a/gocd/verify-repo-built-successful.py +++ b/gocd/verify-repo-built-successful.py @@ -14,9 +14,10 @@ from lxml import etree as ET if __name__ == '__main__': parser = argparse.ArgumentParser(description='Check if all packages built fine') parser.add_argument('--apiurl', '-A', type=str, help='API URL of OBS') - parser.add_argument('-p', '--project', type=str, help='Project to check') + parser.add_argument('-p', '--project', type=str, help='Project to check', + required=True) parser.add_argument('-r', '--repository', type=str, - help='Repository to check') + help='Repository to check', required=True) args = parser.parse_args() From 0cc8a43ba1cad8c6ad8b383a1ff478a0353903ca Mon Sep 17 00:00:00 2001 From: Eugenio Paolantonio Date: Mon, 17 Jun 2024 16:16:22 +0200 Subject: [PATCH 2/4] verify-repo-built-successful: properly handle missing repositories Check for the repo existence, and if missing, exit with a different exit status (2). Signed-off-by: Eugenio Paolantonio --- gocd/verify-repo-built-successful.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gocd/verify-repo-built-successful.py b/gocd/verify-repo-built-successful.py index dda16c26..23fe92b7 100755 --- a/gocd/verify-repo-built-successful.py +++ b/gocd/verify-repo-built-successful.py @@ -27,7 +27,14 @@ if __name__ == '__main__': logging.basicConfig(level=logging.DEBUG) logger = logging.getLogger(__name__) - # first check if repo is finished + # first check if repo is available + url = makeurl(apiurl, ['source', args.project, "_meta"]) + root = ET.parse(http_GET(url)).getroot() + if not root.xpath(f'repository[@name="{args.repository}"]'): + logger.error(f'Repository {args.repository} is not available in {args.project}') + sys.exit(2) + + # then check if repo is finished archs = target_archs(apiurl, args.project, args.repository) for arch in archs: url = makeurl(apiurl, ['build', args.project, args.repository, arch], {'view': 'status'}) From 41c61c3ebf3c1260ad9862f7ac3b5cdab2937d6c Mon Sep 17 00:00:00 2001 From: Eugenio Paolantonio Date: Mon, 17 Jun 2024 16:24:01 +0200 Subject: [PATCH 3/4] 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 --- gocd/slfo-stagings.gocd.yaml | 77 +++++++++++++++++++++++++++----- gocd/slfo-stagings.gocd.yaml.erb | 7 ++- 2 files changed, 72 insertions(+), 12 deletions(-) diff --git a/gocd/slfo-stagings.gocd.yaml b/gocd/slfo-stagings.gocd.yaml index 5eac64bf..bbea109c 100644 --- a/gocd/slfo-stagings.gocd.yaml +++ b/gocd/slfo-stagings.gocd.yaml @@ -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 diff --git a/gocd/slfo-stagings.gocd.yaml.erb b/gocd/slfo-stagings.gocd.yaml.erb index 74b685e2..d4395e12 100644 --- a/gocd/slfo-stagings.gocd.yaml.erb +++ b/gocd/slfo-stagings.gocd.yaml.erb @@ -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 From b02709db3121f3f82ffde018d513a55b102f1898 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dirk=20M=C3=BCller?= Date: Mon, 17 Jun 2024 17:15:13 +0200 Subject: [PATCH 4/4] Switch CI to Leap 15.6 --- .github/workflows/ci-test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci-test.yml b/.github/workflows/ci-test.yml index 890cf4c9..43278b6e 100644 --- a/.github/workflows/ci-test.yml +++ b/.github/workflows/ci-test.yml @@ -44,7 +44,7 @@ jobs: matrix: image: - registry.opensuse.org/opensuse/tumbleweed:latest - - registry.opensuse.org/opensuse/leap:15.5 + - registry.opensuse.org/opensuse/leap:15.6 container: ${{ matrix.image }} steps: @@ -61,8 +61,8 @@ jobs: run: zypper -n ar https://download.opensuse.org/repositories/openSUSE:/Tools/openSUSE_Tumbleweed/openSUSE:Tools.repo - name: add the openSUSE:Tools repository for Leap - if: ${{ contains(matrix.image, '15.5') }} - run: zypper -n ar https://download.opensuse.org/repositories/openSUSE:/Tools/15.5/openSUSE:Tools.repo + if: ${{ contains(matrix.image, '15.6') }} + run: zypper -n ar https://download.opensuse.org/repositories/openSUSE:/Tools/15.6/openSUSE:Tools.repo - name: install the build & runtime dependencies of openSUSE-release-tool run: |