Move verify-repo-built-successful.py here

This commit is contained in:
Stephan Kulow 2019-05-18 17:25:26 +02:00
parent 53b050346d
commit 63026fde23
3 changed files with 114 additions and 201 deletions

View File

@ -149,21 +149,15 @@ pipelines:
destination: scripts
whitelist:
- DO_NOT_TRIGGER
citest:
git: https://github.com/coolo/citest.git
auto_update: true
destination: citest
whitelist:
- DO_NOT_TRIGGER
stages:
- Checks:
jobs:
Check.Build.Succeeds:
resources:
- staging-bot
- staging-bot3
tasks:
- script: |-
python ./citest/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard
python3 ./scripts/gocd/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard
Repo.Checker:
environment_variables:
@ -183,7 +177,7 @@ pipelines:
- Enable.images.repo:
resources:
- staging-bot
- staging-bot3
tasks:
- script: |-
osc -A $STAGING_API api -X POST "/source/$STAGING_PROJECT?cmd=remove_flag&repository=images&flag=build"
@ -209,21 +203,15 @@ pipelines:
destination: scripts
whitelist:
- DO_NOT_TRIGGER
citest:
git: https://github.com/coolo/citest.git
auto_update: true
destination: citest
whitelist:
- DO_NOT_TRIGGER
stages:
- Checks:
jobs:
Check.Build.Succeeds:
resources:
- staging-bot
- staging-bot3
tasks:
- script: |-
python ./citest/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard
python3 ./scripts/gocd/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard
Repo.Checker:
environment_variables:
@ -243,7 +231,7 @@ pipelines:
- Enable.images.repo:
resources:
- staging-bot
- staging-bot3
tasks:
- script: |-
osc -A $STAGING_API api -X POST "/source/$STAGING_PROJECT?cmd=remove_flag&repository=images&flag=build"
@ -269,21 +257,15 @@ pipelines:
destination: scripts
whitelist:
- DO_NOT_TRIGGER
citest:
git: https://github.com/coolo/citest.git
auto_update: true
destination: citest
whitelist:
- DO_NOT_TRIGGER
stages:
- Checks:
jobs:
Check.Build.Succeeds:
resources:
- staging-bot
- staging-bot3
tasks:
- script: |-
python ./citest/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard
python3 ./scripts/gocd/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard
Repo.Checker:
environment_variables:
@ -303,7 +285,7 @@ pipelines:
- Enable.images.repo:
resources:
- staging-bot
- staging-bot3
tasks:
- script: |-
osc -A $STAGING_API api -X POST "/source/$STAGING_PROJECT?cmd=remove_flag&repository=images&flag=build"
@ -329,21 +311,15 @@ pipelines:
destination: scripts
whitelist:
- DO_NOT_TRIGGER
citest:
git: https://github.com/coolo/citest.git
auto_update: true
destination: citest
whitelist:
- DO_NOT_TRIGGER
stages:
- Checks:
jobs:
Check.Build.Succeeds:
resources:
- staging-bot
- staging-bot3
tasks:
- script: |-
python ./citest/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard
python3 ./scripts/gocd/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard
Repo.Checker:
environment_variables:
@ -363,7 +339,7 @@ pipelines:
- Enable.images.repo:
resources:
- staging-bot
- staging-bot3
tasks:
- script: |-
osc -A $STAGING_API api -X POST "/source/$STAGING_PROJECT?cmd=remove_flag&repository=images&flag=build"
@ -389,21 +365,15 @@ pipelines:
destination: scripts
whitelist:
- DO_NOT_TRIGGER
citest:
git: https://github.com/coolo/citest.git
auto_update: true
destination: citest
whitelist:
- DO_NOT_TRIGGER
stages:
- Checks:
jobs:
Check.Build.Succeeds:
resources:
- staging-bot
- staging-bot3
tasks:
- script: |-
python ./citest/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard
python3 ./scripts/gocd/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard
Repo.Checker:
environment_variables:
@ -423,7 +393,7 @@ pipelines:
- Enable.images.repo:
resources:
- staging-bot
- staging-bot3
tasks:
- script: |-
osc -A $STAGING_API api -X POST "/source/$STAGING_PROJECT?cmd=remove_flag&repository=images&flag=build"
@ -449,21 +419,15 @@ pipelines:
destination: scripts
whitelist:
- DO_NOT_TRIGGER
citest:
git: https://github.com/coolo/citest.git
auto_update: true
destination: citest
whitelist:
- DO_NOT_TRIGGER
stages:
- Checks:
jobs:
Check.Build.Succeeds:
resources:
- staging-bot
- staging-bot3
tasks:
- script: |-
python ./citest/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard
python3 ./scripts/gocd/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard
Repo.Checker:
environment_variables:
@ -483,7 +447,7 @@ pipelines:
- Enable.images.repo:
resources:
- staging-bot
- staging-bot3
tasks:
- script: |-
osc -A $STAGING_API api -X POST "/source/$STAGING_PROJECT?cmd=remove_flag&repository=images&flag=build"
@ -509,21 +473,15 @@ pipelines:
destination: scripts
whitelist:
- DO_NOT_TRIGGER
citest:
git: https://github.com/coolo/citest.git
auto_update: true
destination: citest
whitelist:
- DO_NOT_TRIGGER
stages:
- Checks:
jobs:
Check.Build.Succeeds:
resources:
- staging-bot
- staging-bot3
tasks:
- script: |-
python ./citest/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard
python3 ./scripts/gocd/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard
Repo.Checker:
environment_variables:
@ -543,7 +501,7 @@ pipelines:
- Enable.images.repo:
resources:
- staging-bot
- staging-bot3
tasks:
- script: |-
osc -A $STAGING_API api -X POST "/source/$STAGING_PROJECT?cmd=remove_flag&repository=images&flag=build"
@ -569,21 +527,15 @@ pipelines:
destination: scripts
whitelist:
- DO_NOT_TRIGGER
citest:
git: https://github.com/coolo/citest.git
auto_update: true
destination: citest
whitelist:
- DO_NOT_TRIGGER
stages:
- Checks:
jobs:
Check.Build.Succeeds:
resources:
- staging-bot
- staging-bot3
tasks:
- script: |-
python ./citest/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard
python3 ./scripts/gocd/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard
Repo.Checker:
environment_variables:
@ -603,7 +555,7 @@ pipelines:
- Enable.images.repo:
resources:
- staging-bot
- staging-bot3
tasks:
- script: |-
osc -A $STAGING_API api -X POST "/source/$STAGING_PROJECT?cmd=remove_flag&repository=images&flag=build"
@ -629,21 +581,15 @@ pipelines:
destination: scripts
whitelist:
- DO_NOT_TRIGGER
citest:
git: https://github.com/coolo/citest.git
auto_update: true
destination: citest
whitelist:
- DO_NOT_TRIGGER
stages:
- Checks:
jobs:
Check.Build.Succeeds:
resources:
- staging-bot
- staging-bot3
tasks:
- script: |-
python ./citest/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard
python3 ./scripts/gocd/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard
Repo.Checker:
environment_variables:
@ -663,7 +609,7 @@ pipelines:
- Enable.images.repo:
resources:
- staging-bot
- staging-bot3
tasks:
- script: |-
osc -A $STAGING_API api -X POST "/source/$STAGING_PROJECT?cmd=remove_flag&repository=images&flag=build"
@ -689,21 +635,15 @@ pipelines:
destination: scripts
whitelist:
- DO_NOT_TRIGGER
citest:
git: https://github.com/coolo/citest.git
auto_update: true
destination: citest
whitelist:
- DO_NOT_TRIGGER
stages:
- Checks:
jobs:
Check.Build.Succeeds:
resources:
- staging-bot
- staging-bot3
tasks:
- script: |-
python ./citest/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard
python3 ./scripts/gocd/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard
Repo.Checker:
environment_variables:
@ -723,7 +663,7 @@ pipelines:
- Enable.images.repo:
resources:
- staging-bot
- staging-bot3
tasks:
- script: |-
osc -A $STAGING_API api -X POST "/source/$STAGING_PROJECT?cmd=remove_flag&repository=images&flag=build"
@ -749,21 +689,15 @@ pipelines:
destination: scripts
whitelist:
- DO_NOT_TRIGGER
citest:
git: https://github.com/coolo/citest.git
auto_update: true
destination: citest
whitelist:
- DO_NOT_TRIGGER
stages:
- Checks:
jobs:
Check.Build.Succeeds:
resources:
- staging-bot
- staging-bot3
tasks:
- script: |-
python ./citest/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard
python3 ./scripts/gocd/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard
Repo.Checker:
environment_variables:
@ -783,7 +717,7 @@ pipelines:
- Enable.images.repo:
resources:
- staging-bot
- staging-bot3
tasks:
- script: |-
osc -A $STAGING_API api -X POST "/source/$STAGING_PROJECT?cmd=remove_flag&repository=images&flag=build"
@ -809,21 +743,15 @@ pipelines:
destination: scripts
whitelist:
- DO_NOT_TRIGGER
citest:
git: https://github.com/coolo/citest.git
auto_update: true
destination: citest
whitelist:
- DO_NOT_TRIGGER
stages:
- Checks:
jobs:
Check.Build.Succeeds:
resources:
- staging-bot
- staging-bot3
tasks:
- script: |-
python ./citest/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard
python3 ./scripts/gocd/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard
Repo.Checker:
environment_variables:
@ -843,7 +771,7 @@ pipelines:
- Enable.images.repo:
resources:
- staging-bot
- staging-bot3
tasks:
- script: |-
osc -A $STAGING_API api -X POST "/source/$STAGING_PROJECT?cmd=remove_flag&repository=images&flag=build"
@ -869,21 +797,15 @@ pipelines:
destination: scripts
whitelist:
- DO_NOT_TRIGGER
citest:
git: https://github.com/coolo/citest.git
auto_update: true
destination: citest
whitelist:
- DO_NOT_TRIGGER
stages:
- Checks:
jobs:
Check.Build.Succeeds:
resources:
- staging-bot
- staging-bot3
tasks:
- script: |-
python ./citest/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard
python3 ./scripts/gocd/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard
Repo.Checker:
environment_variables:
@ -903,7 +825,7 @@ pipelines:
- Enable.images.repo:
resources:
- staging-bot
- staging-bot3
tasks:
- script: |-
osc -A $STAGING_API api -X POST "/source/$STAGING_PROJECT?cmd=remove_flag&repository=images&flag=build"
@ -929,21 +851,15 @@ pipelines:
destination: scripts
whitelist:
- DO_NOT_TRIGGER
citest:
git: https://github.com/coolo/citest.git
auto_update: true
destination: citest
whitelist:
- DO_NOT_TRIGGER
stages:
- Checks:
jobs:
Check.Build.Succeeds:
resources:
- staging-bot
- staging-bot3
tasks:
- script: |-
python ./citest/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard
python3 ./scripts/gocd/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard
Repo.Checker:
environment_variables:
@ -963,7 +879,7 @@ pipelines:
- Enable.images.repo:
resources:
- staging-bot
- staging-bot3
tasks:
- script: |-
osc -A $STAGING_API api -X POST "/source/$STAGING_PROJECT?cmd=remove_flag&repository=images&flag=build"
@ -989,21 +905,15 @@ pipelines:
destination: scripts
whitelist:
- DO_NOT_TRIGGER
citest:
git: https://github.com/coolo/citest.git
auto_update: true
destination: citest
whitelist:
- DO_NOT_TRIGGER
stages:
- Checks:
jobs:
Check.Build.Succeeds:
resources:
- staging-bot
- staging-bot3
tasks:
- script: |-
python ./citest/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard
python3 ./scripts/gocd/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard
Repo.Checker:
environment_variables:
@ -1023,7 +933,7 @@ pipelines:
- Enable.images.repo:
resources:
- staging-bot
- staging-bot3
tasks:
- script: |-
osc -A $STAGING_API api -X POST "/source/$STAGING_PROJECT?cmd=remove_flag&repository=images&flag=build"
@ -1049,21 +959,15 @@ pipelines:
destination: scripts
whitelist:
- DO_NOT_TRIGGER
citest:
git: https://github.com/coolo/citest.git
auto_update: true
destination: citest
whitelist:
- DO_NOT_TRIGGER
stages:
- Checks:
jobs:
Check.Build.Succeeds:
resources:
- staging-bot
- staging-bot3
tasks:
- script: |-
python ./citest/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard
python3 ./scripts/gocd/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard
Repo.Checker:
environment_variables:
@ -1083,7 +987,7 @@ pipelines:
- Enable.images.repo:
resources:
- staging-bot
- staging-bot3
tasks:
- script: |-
osc -A $STAGING_API api -X POST "/source/$STAGING_PROJECT?cmd=remove_flag&repository=images&flag=build"
@ -1161,21 +1065,15 @@ pipelines:
destination: scripts
whitelist:
- DO_NOT_TRIGGER
citest:
git: https://github.com/coolo/citest.git
auto_update: true
destination: citest
whitelist:
- DO_NOT_TRIGGER
stages:
- Checks:
jobs:
Check.Build.Succeeds:
resources:
- staging-bot
- staging-bot3
tasks:
- script: |-
python ./citest/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard
python3 ./scripts/gocd/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard
Repo.Checker:
environment_variables:
@ -1213,21 +1111,15 @@ pipelines:
destination: scripts
whitelist:
- DO_NOT_TRIGGER
citest:
git: https://github.com/coolo/citest.git
auto_update: true
destination: citest
whitelist:
- DO_NOT_TRIGGER
stages:
- Checks:
jobs:
Check.Build.Succeeds:
resources:
- staging-bot
- staging-bot3
tasks:
- script: |-
python ./citest/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard
python3 ./scripts/gocd/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard
Repo.Checker:
environment_variables:
@ -1265,21 +1157,15 @@ pipelines:
destination: scripts
whitelist:
- DO_NOT_TRIGGER
citest:
git: https://github.com/coolo/citest.git
auto_update: true
destination: citest
whitelist:
- DO_NOT_TRIGGER
stages:
- Checks:
jobs:
Check.Build.Succeeds:
resources:
- staging-bot
- staging-bot3
tasks:
- script: |-
python ./citest/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard
python3 ./scripts/gocd/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard
Repo.Checker:
environment_variables:
@ -1317,21 +1203,15 @@ pipelines:
destination: scripts
whitelist:
- DO_NOT_TRIGGER
citest:
git: https://github.com/coolo/citest.git
auto_update: true
destination: citest
whitelist:
- DO_NOT_TRIGGER
stages:
- Checks:
jobs:
Check.Build.Succeeds:
resources:
- staging-bot
- staging-bot3
tasks:
- script: |-
python ./citest/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard
python3 ./scripts/gocd/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard
Repo.Checker:
environment_variables:
@ -1369,21 +1249,15 @@ pipelines:
destination: scripts
whitelist:
- DO_NOT_TRIGGER
citest:
git: https://github.com/coolo/citest.git
auto_update: true
destination: citest
whitelist:
- DO_NOT_TRIGGER
stages:
- Checks:
jobs:
Check.Build.Succeeds:
resources:
- staging-bot
- staging-bot3
tasks:
- script: |-
python ./citest/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard
python3 ./scripts/gocd/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard
Repo.Checker:
environment_variables:

View File

@ -47,21 +47,15 @@ pipelines:
destination: scripts
whitelist:
- DO_NOT_TRIGGER
citest:
git: https://github.com/coolo/citest.git
auto_update: true
destination: citest
whitelist:
- DO_NOT_TRIGGER
stages:
- Checks:
jobs:
Check.Build.Succeeds:
resources:
- staging-bot
- staging-bot3
tasks:
- script: |-
python ./citest/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard
python3 ./scripts/gocd/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard
Repo.Checker:
environment_variables:
@ -81,7 +75,7 @@ pipelines:
- Enable.images.repo:
resources:
- staging-bot
- staging-bot3
tasks:
- script: |-
osc -A $STAGING_API api -X POST "/source/$STAGING_PROJECT?cmd=remove_flag&repository=images&flag=build"
@ -134,21 +128,15 @@ pipelines:
destination: scripts
whitelist:
- DO_NOT_TRIGGER
citest:
git: https://github.com/coolo/citest.git
auto_update: true
destination: citest
whitelist:
- DO_NOT_TRIGGER
stages:
- Checks:
jobs:
Check.Build.Succeeds:
resources:
- staging-bot
- staging-bot3
tasks:
- script: |-
python ./citest/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard
python3 ./scripts/gocd/verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard
Repo.Checker:
environment_variables:

View File

@ -0,0 +1,51 @@
#!/usr/bin/python3
from __future__ import print_function
import argparse
import logging
import sys
import osc
from osc.core import http_GET, makeurl
from osclib.core import target_archs
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('-r', '--repository', type=str,
help='Repository to check')
args = parser.parse_args()
osc.conf.get_config(override_apiurl=args.apiurl)
apiurl = osc.conf.config['apiurl']
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)
# first 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'})
root = ET.parse(http_GET(url)).getroot()
if root.get('code') == 'finished':
continue
logger.error('Repository {}/{}/{} is not yet finished'.format(args.project, args.repository, arch))
logger.debug(ET.tostring(root))
sys.exit(1)
# now check if all packages built fine
url = makeurl(apiurl, ['build', args.project, '_result'],
{'view': 'summary', 'repository': args.repository})
root = ET.parse(http_GET(url)).getroot()
for count in root.findall('.//statuscount'):
if int(count.get('count', 0)) == 0:
continue
if count.get('code') in ['succeeded', 'excluded', 'disabled']:
continue
logger.error('Repository {}/{} is has {} packages'.format(args.project, args.repository, count.get('code')))
sys.exit(1)