diff --git a/dist/ci/docker-compose.yml b/dist/ci/docker-compose.yml index dea3e3e3..e8d38727 100644 --- a/dist/ci/docker-compose.yml +++ b/dist/ci/docker-compose.yml @@ -1,7 +1,7 @@ version: "3.4" x-obs: &obs - image: registry.opensuse.org/opensuse/tools/images/containers/osrt_miniobs:latest + image: registry.opensuse.org/opensuse/tools/images/containers151/osrt_miniobs:latest x-testenv: &testenv image: registry.opensuse.org/opensuse/tools/images/containers_tumbleweed/osrt_testenv_tumbleweed:latest diff --git a/dist/ci/miniobs/Dockerfile b/dist/ci/miniobs/Dockerfile index 81dc772a..2e50f6cf 100644 --- a/dist/ci/miniobs/Dockerfile +++ b/dist/ci/miniobs/Dockerfile @@ -1,7 +1,7 @@ #!BuildTag: osrt_miniobs -FROM opensuse-leap-15.0:current +FROM opensuse/leap:15.1 -RUN zypper ar http://download.opensuse.org/repositories/OBS:/Server:/Unstable/openSUSE_15.0/ 'O:S:U'; \ +RUN zypper ar http://download.opensuse.org/repositories/OBS:/Server:/Unstable/openSUSE_15.1/ 'O:S:U'; \ zypper --gpg-auto-import-keys refresh RUN zypper install -y obs-api obs-worker obs-server \ diff --git a/gocd/checkers.opensuse.gocd.yaml b/gocd/checkers.opensuse.gocd.yaml index 52a1c14f..2809eac2 100644 --- a/gocd/checkers.opensuse.gocd.yaml +++ b/gocd/checkers.opensuse.gocd.yaml @@ -42,3 +42,45 @@ pipelines: - repo-checker3 tasks: - script: ./repo_checker.py -A https://api.opensuse.org --debug review + Factory.Staging.Report: + group: openSUSE.Checkers + lock_behavior: unlockWhenFinished + timer: + spec: 0 */3 * ? * * + environment_variables: + OSC_CONFIG: /home/go/config/oscrc-staging-bot + materials: + git: + git: https://github.com/openSUSE/openSUSE-release-tools.git + stages: + - Run: + approval: + type: manual + jobs: + Run: + timeout: 0 + resources: + - staging-bot3 + tasks: + - script: ./staging-report.py --debug -A https://api.opensuse.org -p openSUSE:Factory + Leap.Staging.Report: + group: openSUSE.Checkers + lock_behavior: unlockWhenFinished + timer: + spec: 0 */3 * ? * * + environment_variables: + OSC_CONFIG: /home/go/config/oscrc-staging-bot + materials: + git: + git: https://github.com/openSUSE/openSUSE-release-tools.git + stages: + - Run: + approval: + type: manual + jobs: + Run: + timeout: 0 + resources: + - staging-bot3 + tasks: + - script: ./staging-report.py --debug -A https://api.opensuse.org -p openSUSE:Leap:15.1 diff --git a/gocd/pkglistgen_staging.gocd.yaml b/gocd/pkglistgen_staging.gocd.yaml index f905151d..fefd4a80 100644 --- a/gocd/pkglistgen_staging.gocd.yaml +++ b/gocd/pkglistgen_staging.gocd.yaml @@ -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: diff --git a/gocd/pkglistgen_staging.gocd.yaml.erb b/gocd/pkglistgen_staging.gocd.yaml.erb index f3211ff5..09148ee7 100644 --- a/gocd/pkglistgen_staging.gocd.yaml.erb +++ b/gocd/pkglistgen_staging.gocd.yaml.erb @@ -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: diff --git a/gocd/report-status.py b/gocd/report-status.py new file mode 100755 index 00000000..fc64057c --- /dev/null +++ b/gocd/report-status.py @@ -0,0 +1,95 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright (c) 2018 SUSE Linux GmbH +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +import argparse +import os +import sys +from xml.etree import cElementTree as ET + +import osc.core +from osclib.core import target_archs + +try: + from urllib.error import HTTPError +except ImportError: + # python 2.x + from urllib2 import HTTPError + +makeurl = osc.core.makeurl +http_GET = osc.core.http_GET +http_POST = osc.core.http_POST + +def report_pipeline(args, architecture, is_last): + url = makeurl(args.apiurl, [ + 'build', args.project, args.repository, architecture], {'view': 'status'}) + root = ET.parse(http_GET(url)).getroot() + buildid = root.find('buildid') + if buildid is None: + return False + buildid = buildid.text + url = makeurl(args.apiurl, ['status_reports', 'built', args.project, + args.repository, architecture, 'reports', buildid]) + name = 'gitlab-pipeline' + state = args.state + # this is a little bit ugly, but we don't need 2 failures. So save a success for the + # other archs to mark them as visited - pending we put in both + if not is_last: + if state == 'failure': + state = 'success' + name = name + ':' + architecture + report_url = os.environ.get('GO_SERVER_URL').replace(':8154', '') + report_url = report_url + '/tab/build/detail/{}/{}/{}/{}/{}#tab-console'.format(os.environ.get('GO_PIPELINE_NAME'), os.environ.get('GO_PIPELINE_COUNTER'), os.environ.get('GO_STAGE_NAME'), os.environ.get('GO_STAGE_COUNTER'), os.environ.get('GO_JOB_NAME')) + xml = check_xml(report_url, state, name) + try: + http_POST(url, data=xml) + except HTTPError: + print('failed to post status to ' + url) + sys.exit(1) + +def check_xml(url, state, name): + check = ET.Element('check') + if url: + se = ET.SubElement(check, 'url') + se.text = url + se = ET.SubElement(check, 'state') + se.text = state + se = ET.SubElement(check, 'name') + se.text = name + return ET.tostring(check) + +if __name__ == '__main__': + description = 'Create SR from FactoryCandidates to '\ + 'openSUSE Leap project for new build succeded packages.' + parser = argparse.ArgumentParser(description=description) + parser.add_argument('-A', '--apiurl', metavar='URL', help='API URL', required=True) + parser.add_argument('-p', '--project', metavar='PROJECT', help='Project', required=True) + parser.add_argument('-r', '--repository', metavar='REPOSITORY', help='Repository', required=True) + parser.add_argument('-s', '--state', metavar='STATE', help='Status to report', required=True) + + args = parser.parse_args() + # Configure OSC + osc.conf.get_config(override_apiurl=args.apiurl) + #osc.conf.config['debug'] = 1 + + architectures = sorted(target_archs(args.apiurl, args.project, args.repository)) + for arch in architectures: + report_pipeline(args, arch, arch == architectures[-1]) diff --git a/gocd/sp1-stagings.gocd.yaml b/gocd/sp1-stagings.gocd.yaml new file mode 100644 index 00000000..61d3ead0 --- /dev/null +++ b/gocd/sp1-stagings.gocd.yaml @@ -0,0 +1,591 @@ +--- +format_version: 3 +pipelines: + SLE15.SP1.Stagings.RelPkgs: + environment_variables: + OSC_CONFIG: /home/go/config/oscrc-staging-bot + group: SLE15.SP1.Stagings + lock_behavior: unlockWhenFinished + timer: + spec: 0 */10 * ? * * + only_on_changes: false + materials: + scripts: + git: https://github.com/openSUSE/openSUSE-release-tools.git + stages: + - Generate.Release.Package: + approval: manual + jobs: + SLE.15.SP1.Staging.A: + resources: + - repo-checker + tasks: + - script: /usr/bin/osrt-pkglistgen -A https://api.suse.de update_and_solve + --staging SUSE:SLE-15-SP1:GA:Staging:A + --only-release-packages --force + SLE.15.SP1.Staging.B: + resources: + - repo-checker + tasks: + - script: /usr/bin/osrt-pkglistgen -A https://api.suse.de update_and_solve + --staging SUSE:SLE-15-SP1:GA:Staging:B + --only-release-packages --force + SLE.15.SP1.Staging.C: + resources: + - repo-checker + tasks: + - script: /usr/bin/osrt-pkglistgen -A https://api.suse.de update_and_solve + --staging SUSE:SLE-15-SP1:GA:Staging:C + --only-release-packages --force + SLE.15.SP1.Staging.D: + resources: + - repo-checker + tasks: + - script: /usr/bin/osrt-pkglistgen -A https://api.suse.de update_and_solve + --staging SUSE:SLE-15-SP1:GA:Staging:D + --only-release-packages --force + SLE.15.SP1.Staging.E: + resources: + - repo-checker + tasks: + - script: /usr/bin/osrt-pkglistgen -A https://api.suse.de update_and_solve + --staging SUSE:SLE-15-SP1:GA:Staging:E + --only-release-packages --force + SLE.15.SP1.Staging.F: + resources: + - repo-checker + tasks: + - script: /usr/bin/osrt-pkglistgen -A https://api.suse.de update_and_solve + --staging SUSE:SLE-15-SP1:GA:Staging:F + --only-release-packages --force + SLE.15.SP1.Staging.G: + resources: + - repo-checker + tasks: + - script: /usr/bin/osrt-pkglistgen -A https://api.suse.de update_and_solve + --staging SUSE:SLE-15-SP1:GA:Staging:G + --only-release-packages --force + SLE.15.SP1.Staging.H: + resources: + - repo-checker + tasks: + - script: /usr/bin/osrt-pkglistgen -A https://api.suse.de update_and_solve + --staging SUSE:SLE-15-SP1:GA:Staging:H + --only-release-packages --force + SLE.15.SP1.Staging.S: + resources: + - repo-checker + tasks: + - script: /usr/bin/osrt-pkglistgen -A https://api.suse.de update_and_solve + --staging SUSE:SLE-15-SP1:GA:Staging:S + --only-release-packages --force + SLE.15.SP1.Staging.V: + resources: + - repo-checker + tasks: + - script: /usr/bin/osrt-pkglistgen -A https://api.suse.de update_and_solve + --staging SUSE:SLE-15-SP1:GA:Staging:V + --only-release-packages --force + SLE.15.SP1.Staging.Y: + resources: + - repo-checker + tasks: + - script: /usr/bin/osrt-pkglistgen -A https://api.suse.de update_and_solve + --staging SUSE:SLE-15-SP1:GA:Staging:Y + --only-release-packages --force + + SLE15.SP1.Staging.A: + environment_variables: + STAGING_PROJECT: SUSE:SLE-15-SP1:GA:Staging:A + STAGING_API: https://api.suse.de + OSC_CONFIG: /home/go/config/oscrc-staging-bot + PYTHONPATH: /usr/share/openSUSE-release-tools + group: SLE15.SP1.Stagings + lock_behavior: unlockWhenFinished + materials: + stagings: + git: git://botmaster.suse.de/suse-repos.git + auto_update: true + destination: repos + whitelist: + - SUSE:SLE-15-SP1:GA:Staging:A_-_standard.yaml + scripts: + auto_update: true + git: https://github.com/openSUSE/openSUSE-release-tools.git + whitelist: + - DO_NOT_TRIGGER + destination: scripts + stages: + - Check.Build.Succeeds: + resources: + - staging-bot3 + tasks: + - script: |- + cd scripts/gocd + python3 ./report-status.py -A $STAGING_API -p $STAGING_PROJECT -r standard -s pending + python3 ./verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard + + - Update.000product: + resources: + - repo-checker + tasks: + - script: |- + cd scripts/gocd + + if /usr/bin/osrt-pkglistgen --debug -A $STAGING_API update_and_solve --staging $STAGING_PROJECT --force; then + python ./report-status.py -A $STAGING_API -p $STAGING_PROJECT -r standard -s success + else + python ./report-status.py -A $STAGING_API -p $STAGING_PROJECT -r standard -s failure + exit 1 + fi + + SLE15.SP1.Staging.B: + environment_variables: + STAGING_PROJECT: SUSE:SLE-15-SP1:GA:Staging:B + STAGING_API: https://api.suse.de + OSC_CONFIG: /home/go/config/oscrc-staging-bot + PYTHONPATH: /usr/share/openSUSE-release-tools + group: SLE15.SP1.Stagings + lock_behavior: unlockWhenFinished + materials: + stagings: + git: git://botmaster.suse.de/suse-repos.git + auto_update: true + destination: repos + whitelist: + - SUSE:SLE-15-SP1:GA:Staging:B_-_standard.yaml + scripts: + auto_update: true + git: https://github.com/openSUSE/openSUSE-release-tools.git + whitelist: + - DO_NOT_TRIGGER + destination: scripts + stages: + - Check.Build.Succeeds: + resources: + - staging-bot3 + tasks: + - script: |- + cd scripts/gocd + python3 ./report-status.py -A $STAGING_API -p $STAGING_PROJECT -r standard -s pending + python3 ./verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard + + - Update.000product: + resources: + - repo-checker + tasks: + - script: |- + cd scripts/gocd + + if /usr/bin/osrt-pkglistgen --debug -A $STAGING_API update_and_solve --staging $STAGING_PROJECT --force; then + python ./report-status.py -A $STAGING_API -p $STAGING_PROJECT -r standard -s success + else + python ./report-status.py -A $STAGING_API -p $STAGING_PROJECT -r standard -s failure + exit 1 + fi + + SLE15.SP1.Staging.C: + environment_variables: + STAGING_PROJECT: SUSE:SLE-15-SP1:GA:Staging:C + STAGING_API: https://api.suse.de + OSC_CONFIG: /home/go/config/oscrc-staging-bot + PYTHONPATH: /usr/share/openSUSE-release-tools + group: SLE15.SP1.Stagings + lock_behavior: unlockWhenFinished + materials: + stagings: + git: git://botmaster.suse.de/suse-repos.git + auto_update: true + destination: repos + whitelist: + - SUSE:SLE-15-SP1:GA:Staging:C_-_standard.yaml + scripts: + auto_update: true + git: https://github.com/openSUSE/openSUSE-release-tools.git + whitelist: + - DO_NOT_TRIGGER + destination: scripts + stages: + - Check.Build.Succeeds: + resources: + - staging-bot3 + tasks: + - script: |- + cd scripts/gocd + python3 ./report-status.py -A $STAGING_API -p $STAGING_PROJECT -r standard -s pending + python3 ./verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard + + - Update.000product: + resources: + - repo-checker + tasks: + - script: |- + cd scripts/gocd + + if /usr/bin/osrt-pkglistgen --debug -A $STAGING_API update_and_solve --staging $STAGING_PROJECT --force; then + python ./report-status.py -A $STAGING_API -p $STAGING_PROJECT -r standard -s success + else + python ./report-status.py -A $STAGING_API -p $STAGING_PROJECT -r standard -s failure + exit 1 + fi + + SLE15.SP1.Staging.D: + environment_variables: + STAGING_PROJECT: SUSE:SLE-15-SP1:GA:Staging:D + STAGING_API: https://api.suse.de + OSC_CONFIG: /home/go/config/oscrc-staging-bot + PYTHONPATH: /usr/share/openSUSE-release-tools + group: SLE15.SP1.Stagings + lock_behavior: unlockWhenFinished + materials: + stagings: + git: git://botmaster.suse.de/suse-repos.git + auto_update: true + destination: repos + whitelist: + - SUSE:SLE-15-SP1:GA:Staging:D_-_standard.yaml + scripts: + auto_update: true + git: https://github.com/openSUSE/openSUSE-release-tools.git + whitelist: + - DO_NOT_TRIGGER + destination: scripts + stages: + - Check.Build.Succeeds: + resources: + - staging-bot3 + tasks: + - script: |- + cd scripts/gocd + python3 ./report-status.py -A $STAGING_API -p $STAGING_PROJECT -r standard -s pending + python3 ./verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard + + - Update.000product: + resources: + - repo-checker + tasks: + - script: |- + cd scripts/gocd + + if /usr/bin/osrt-pkglistgen --debug -A $STAGING_API update_and_solve --staging $STAGING_PROJECT --force; then + python ./report-status.py -A $STAGING_API -p $STAGING_PROJECT -r standard -s success + else + python ./report-status.py -A $STAGING_API -p $STAGING_PROJECT -r standard -s failure + exit 1 + fi + + SLE15.SP1.Staging.E: + environment_variables: + STAGING_PROJECT: SUSE:SLE-15-SP1:GA:Staging:E + STAGING_API: https://api.suse.de + OSC_CONFIG: /home/go/config/oscrc-staging-bot + PYTHONPATH: /usr/share/openSUSE-release-tools + group: SLE15.SP1.Stagings + lock_behavior: unlockWhenFinished + materials: + stagings: + git: git://botmaster.suse.de/suse-repos.git + auto_update: true + destination: repos + whitelist: + - SUSE:SLE-15-SP1:GA:Staging:E_-_standard.yaml + scripts: + auto_update: true + git: https://github.com/openSUSE/openSUSE-release-tools.git + whitelist: + - DO_NOT_TRIGGER + destination: scripts + stages: + - Check.Build.Succeeds: + resources: + - staging-bot3 + tasks: + - script: |- + cd scripts/gocd + python3 ./report-status.py -A $STAGING_API -p $STAGING_PROJECT -r standard -s pending + python3 ./verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard + + - Update.000product: + resources: + - repo-checker + tasks: + - script: |- + cd scripts/gocd + + if /usr/bin/osrt-pkglistgen --debug -A $STAGING_API update_and_solve --staging $STAGING_PROJECT --force; then + python ./report-status.py -A $STAGING_API -p $STAGING_PROJECT -r standard -s success + else + python ./report-status.py -A $STAGING_API -p $STAGING_PROJECT -r standard -s failure + exit 1 + fi + + SLE15.SP1.Staging.F: + environment_variables: + STAGING_PROJECT: SUSE:SLE-15-SP1:GA:Staging:F + STAGING_API: https://api.suse.de + OSC_CONFIG: /home/go/config/oscrc-staging-bot + PYTHONPATH: /usr/share/openSUSE-release-tools + group: SLE15.SP1.Stagings + lock_behavior: unlockWhenFinished + materials: + stagings: + git: git://botmaster.suse.de/suse-repos.git + auto_update: true + destination: repos + whitelist: + - SUSE:SLE-15-SP1:GA:Staging:F_-_standard.yaml + scripts: + auto_update: true + git: https://github.com/openSUSE/openSUSE-release-tools.git + whitelist: + - DO_NOT_TRIGGER + destination: scripts + stages: + - Check.Build.Succeeds: + resources: + - staging-bot3 + tasks: + - script: |- + cd scripts/gocd + python3 ./report-status.py -A $STAGING_API -p $STAGING_PROJECT -r standard -s pending + python3 ./verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard + + - Update.000product: + resources: + - repo-checker + tasks: + - script: |- + cd scripts/gocd + + if /usr/bin/osrt-pkglistgen --debug -A $STAGING_API update_and_solve --staging $STAGING_PROJECT --force; then + python ./report-status.py -A $STAGING_API -p $STAGING_PROJECT -r standard -s success + else + python ./report-status.py -A $STAGING_API -p $STAGING_PROJECT -r standard -s failure + exit 1 + fi + + SLE15.SP1.Staging.G: + environment_variables: + STAGING_PROJECT: SUSE:SLE-15-SP1:GA:Staging:G + STAGING_API: https://api.suse.de + OSC_CONFIG: /home/go/config/oscrc-staging-bot + PYTHONPATH: /usr/share/openSUSE-release-tools + group: SLE15.SP1.Stagings + lock_behavior: unlockWhenFinished + materials: + stagings: + git: git://botmaster.suse.de/suse-repos.git + auto_update: true + destination: repos + whitelist: + - SUSE:SLE-15-SP1:GA:Staging:G_-_standard.yaml + scripts: + auto_update: true + git: https://github.com/openSUSE/openSUSE-release-tools.git + whitelist: + - DO_NOT_TRIGGER + destination: scripts + stages: + - Check.Build.Succeeds: + resources: + - staging-bot3 + tasks: + - script: |- + cd scripts/gocd + python3 ./report-status.py -A $STAGING_API -p $STAGING_PROJECT -r standard -s pending + python3 ./verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard + + - Update.000product: + resources: + - repo-checker + tasks: + - script: |- + cd scripts/gocd + + if /usr/bin/osrt-pkglistgen --debug -A $STAGING_API update_and_solve --staging $STAGING_PROJECT --force; then + python ./report-status.py -A $STAGING_API -p $STAGING_PROJECT -r standard -s success + else + python ./report-status.py -A $STAGING_API -p $STAGING_PROJECT -r standard -s failure + exit 1 + fi + + SLE15.SP1.Staging.H: + environment_variables: + STAGING_PROJECT: SUSE:SLE-15-SP1:GA:Staging:H + STAGING_API: https://api.suse.de + OSC_CONFIG: /home/go/config/oscrc-staging-bot + PYTHONPATH: /usr/share/openSUSE-release-tools + group: SLE15.SP1.Stagings + lock_behavior: unlockWhenFinished + materials: + stagings: + git: git://botmaster.suse.de/suse-repos.git + auto_update: true + destination: repos + whitelist: + - SUSE:SLE-15-SP1:GA:Staging:H_-_standard.yaml + scripts: + auto_update: true + git: https://github.com/openSUSE/openSUSE-release-tools.git + whitelist: + - DO_NOT_TRIGGER + destination: scripts + stages: + - Check.Build.Succeeds: + resources: + - staging-bot3 + tasks: + - script: |- + cd scripts/gocd + python3 ./report-status.py -A $STAGING_API -p $STAGING_PROJECT -r standard -s pending + python3 ./verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard + + - Update.000product: + resources: + - repo-checker + tasks: + - script: |- + cd scripts/gocd + + if /usr/bin/osrt-pkglistgen --debug -A $STAGING_API update_and_solve --staging $STAGING_PROJECT --force; then + python ./report-status.py -A $STAGING_API -p $STAGING_PROJECT -r standard -s success + else + python ./report-status.py -A $STAGING_API -p $STAGING_PROJECT -r standard -s failure + exit 1 + fi + + SLE15.SP1.Staging.S: + environment_variables: + STAGING_PROJECT: SUSE:SLE-15-SP1:GA:Staging:S + STAGING_API: https://api.suse.de + OSC_CONFIG: /home/go/config/oscrc-staging-bot + PYTHONPATH: /usr/share/openSUSE-release-tools + group: SLE15.SP1.Stagings + lock_behavior: unlockWhenFinished + materials: + stagings: + git: git://botmaster.suse.de/suse-repos.git + auto_update: true + destination: repos + whitelist: + - SUSE:SLE-15-SP1:GA:Staging:S_-_standard.yaml + scripts: + auto_update: true + git: https://github.com/openSUSE/openSUSE-release-tools.git + whitelist: + - DO_NOT_TRIGGER + destination: scripts + stages: + - Check.Build.Succeeds: + resources: + - staging-bot3 + tasks: + - script: |- + cd scripts/gocd + python3 ./report-status.py -A $STAGING_API -p $STAGING_PROJECT -r standard -s pending + python3 ./verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard + + - Update.000product: + resources: + - repo-checker + tasks: + - script: |- + cd scripts/gocd + + if /usr/bin/osrt-pkglistgen --debug -A $STAGING_API update_and_solve --staging $STAGING_PROJECT --force; then + python ./report-status.py -A $STAGING_API -p $STAGING_PROJECT -r standard -s success + else + python ./report-status.py -A $STAGING_API -p $STAGING_PROJECT -r standard -s failure + exit 1 + fi + + SLE15.SP1.Staging.V: + environment_variables: + STAGING_PROJECT: SUSE:SLE-15-SP1:GA:Staging:V + STAGING_API: https://api.suse.de + OSC_CONFIG: /home/go/config/oscrc-staging-bot + PYTHONPATH: /usr/share/openSUSE-release-tools + group: SLE15.SP1.Stagings + lock_behavior: unlockWhenFinished + materials: + stagings: + git: git://botmaster.suse.de/suse-repos.git + auto_update: true + destination: repos + whitelist: + - SUSE:SLE-15-SP1:GA:Staging:V_-_standard.yaml + scripts: + auto_update: true + git: https://github.com/openSUSE/openSUSE-release-tools.git + whitelist: + - DO_NOT_TRIGGER + destination: scripts + stages: + - Check.Build.Succeeds: + resources: + - staging-bot3 + tasks: + - script: |- + cd scripts/gocd + python3 ./report-status.py -A $STAGING_API -p $STAGING_PROJECT -r standard -s pending + python3 ./verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard + + - Update.000product: + resources: + - repo-checker + tasks: + - script: |- + cd scripts/gocd + + if /usr/bin/osrt-pkglistgen --debug -A $STAGING_API update_and_solve --staging $STAGING_PROJECT --force; then + python ./report-status.py -A $STAGING_API -p $STAGING_PROJECT -r standard -s success + else + python ./report-status.py -A $STAGING_API -p $STAGING_PROJECT -r standard -s failure + exit 1 + fi + + SLE15.SP1.Staging.Y: + environment_variables: + STAGING_PROJECT: SUSE:SLE-15-SP1:GA:Staging:Y + STAGING_API: https://api.suse.de + OSC_CONFIG: /home/go/config/oscrc-staging-bot + PYTHONPATH: /usr/share/openSUSE-release-tools + group: SLE15.SP1.Stagings + lock_behavior: unlockWhenFinished + materials: + stagings: + git: git://botmaster.suse.de/suse-repos.git + auto_update: true + destination: repos + whitelist: + - SUSE:SLE-15-SP1:GA:Staging:Y_-_standard.yaml + scripts: + auto_update: true + git: https://github.com/openSUSE/openSUSE-release-tools.git + whitelist: + - DO_NOT_TRIGGER + destination: scripts + stages: + - Check.Build.Succeeds: + resources: + - staging-bot3 + tasks: + - script: |- + cd scripts/gocd + python3 ./report-status.py -A $STAGING_API -p $STAGING_PROJECT -r standard -s pending + python3 ./verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard + + - Update.000product: + resources: + - repo-checker + tasks: + - script: |- + cd scripts/gocd + + if /usr/bin/osrt-pkglistgen --debug -A $STAGING_API update_and_solve --staging $STAGING_PROJECT --force; then + python ./report-status.py -A $STAGING_API -p $STAGING_PROJECT -r standard -s success + else + python ./report-status.py -A $STAGING_API -p $STAGING_PROJECT -r standard -s failure + exit 1 + fi + \ No newline at end of file diff --git a/gocd/sp1-stagings.gocd.yaml.erb b/gocd/sp1-stagings.gocd.yaml.erb new file mode 100644 index 00000000..475f2ff9 --- /dev/null +++ b/gocd/sp1-stagings.gocd.yaml.erb @@ -0,0 +1,74 @@ +--- +<% stagings = %w(A B C D E F G H S V Y) -%> +format_version: 3 +pipelines: + SLE15.SP1.Stagings.RelPkgs: + environment_variables: + OSC_CONFIG: /home/go/config/oscrc-staging-bot + group: SLE15.SP1.Stagings + lock_behavior: unlockWhenFinished + timer: + spec: 0 */10 * ? * * + only_on_changes: false + materials: + scripts: + git: https://github.com/openSUSE/openSUSE-release-tools.git + stages: + - Generate.Release.Package: + approval: manual + jobs: +<% stagings.each do |letter| -%> + SLE.15.SP1.Staging.<%= letter %>: + resources: + - repo-checker + tasks: + - script: /usr/bin/osrt-pkglistgen -A https://api.suse.de update_and_solve + --staging SUSE:SLE-15-SP1:GA:Staging:<%= letter %> + --only-release-packages --force +<% end -%> +<% stagings.each do |letter| %> + SLE15.SP1.Staging.<%= letter %>: + environment_variables: + STAGING_PROJECT: SUSE:SLE-15-SP1:GA:Staging:<%= letter %> + STAGING_API: https://api.suse.de + OSC_CONFIG: /home/go/config/oscrc-staging-bot + PYTHONPATH: /usr/share/openSUSE-release-tools + group: SLE15.SP1.Stagings + lock_behavior: unlockWhenFinished + materials: + stagings: + git: git://botmaster.suse.de/suse-repos.git + auto_update: true + destination: repos + whitelist: + - SUSE:SLE-15-SP1:GA:Staging:<%= letter %>_-_standard.yaml + scripts: + auto_update: true + git: https://github.com/openSUSE/openSUSE-release-tools.git + whitelist: + - DO_NOT_TRIGGER + destination: scripts + stages: + - Check.Build.Succeeds: + resources: + - staging-bot3 + tasks: + - script: |- + cd scripts/gocd + python3 ./report-status.py -A $STAGING_API -p $STAGING_PROJECT -r standard -s pending + python3 ./verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard + + - Update.000product: + resources: + - repo-checker + tasks: + - script: |- + cd scripts/gocd + + if /usr/bin/osrt-pkglistgen --debug -A $STAGING_API update_and_solve --staging $STAGING_PROJECT --force; then + python ./report-status.py -A $STAGING_API -p $STAGING_PROJECT -r standard -s success + else + python ./report-status.py -A $STAGING_API -p $STAGING_PROJECT -r standard -s failure + exit 1 + fi + <% end -%> diff --git a/gocd/sp1.target.gocd.yaml b/gocd/sp1.target.gocd.yaml new file mode 100644 index 00000000..cc084ab1 --- /dev/null +++ b/gocd/sp1.target.gocd.yaml @@ -0,0 +1,87 @@ +format_version: 3 +pipelines: + SLE15.SP1.RelPkgs: + group: SLE15.SP1.Target + lock_behavior: unlockWhenFinished + timer: + spec: 0 10 * ? * * + only_on_changes: false + materials: + git: + git: https://github.com/openSUSE/openSUSE-release-tools.git + environment_variables: + OSC_CONFIG: /home/go/config/oscrc-staging-bot + stages: + - Create.Release.Packages: + approval: manual + resources: + - repo-checker + tasks: + - script: /usr/bin/osrt-pkglistgen -A https://api.suse.de update_and_solve -p SUSE:SLE-15-SP1:GA -s target --only-release-packages --force + + SLE15.SP1.Package.Lists: + group: SLE15.SP1.Target + lock_behavior: unlockWhenFinished + materials: + repos: + git: git://botmaster.suse.de/suse-repos.git + auto_update: true + whitelist: + - SUSE:SLE-15-SP1:GA_-_standard.yaml + environment_variables: + OSC_CONFIG: /home/go/config/oscrc-staging-bot + stages: + - Update.000product: + resources: + - repo-checker + tasks: + - script: |- + /usr/bin/python /usr/bin/osrt-pkglistgen --apiurl https://api.suse.de --debug update_and_solve -p SUSE:SLE-15-SP1:GA -s target --force || true + + SLE15.SP1.Images: + group: SLE15.SP1.Target + lock_behavior: unlockWhenFinished + materials: + repos: + git: git://botmaster.suse.de/suse-repos.git + auto_update: true + whitelist: + - SUSE:SLE-15-SP1:GA_-_images.yaml + 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-bot3 + tasks: + - script: | + export PYTHONPATH=scripts + python3 ./scripts/gocd/verify-repo-built-successful.py -A https://api.suse.de -p SUSE:SLE-15-SP1:GA -r images + + - Release.Images.To.Test: + approval: manual + roles: + - SLE + environment_variables: + OSC_CONFIG: /home/go/config/oscrc-totest-manager + resources: + - staging-bot3 + tasks: + - script: |- + for product in kiwi-templates-SLES15-JeOS \ + SLES15-SP1-Azure SLES15-SP1-Azure-BYOS \ + SLES15-SP1-Azure-Priority SLES15-SP1-Azure-Standard \ + SLES15-SP1-EC2-ECS-HVM SLES15-SP1-EC2-HVM \ + SLES15-SP1-EC2-HVM-BYOS SLES15-SP1-GCE SLES15-SP1-GCE-BYOS \ + SLES15-SP1-SAP-Azure SLES15-SP1-SAP-Azure-BYOS \ + SLES15-SP1-SAP-EC2-HVM SLES15-SP1-SAP-EC2-HVM-BYOS \ + SLES15-SP1-OCI-BYOS SLES15-SP1-SAP-OCI-BYOS \ + SLES15-SP1-SAP-GCE SLES15-SP1-SAP-GCE-BYOS 000product; do + osc -A https://api.suse.de release SUSE:SLE-15-SP1:GA $product + done diff --git a/gocd/verify-repo-built-successful.py b/gocd/verify-repo-built-successful.py new file mode 100755 index 00000000..9306d023 --- /dev/null +++ b/gocd/verify-repo-built-successful.py @@ -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) diff --git a/staging-report.py b/staging-report.py index 72efb882..6f522a9c 100755 --- a/staging-report.py +++ b/staging-report.py @@ -61,7 +61,7 @@ class StagingReport(object): failing_lines = [ '* Build failed %s (%s)' % (key, ', '.join(self._package_url(p) for p in value)) - for key, value in groups.iteritems() + for key, value in groups.items() ] report = '\n'.join(failing_lines[:MAX_LINES])