Merge pull request #3029 from dirkmueller/release_repos_separately
Release bci repositories per architecture independently
This commit is contained in:
commit
c46db9b61a
@ -19,6 +19,7 @@ import re
|
|||||||
from lxml import etree as ET
|
from lxml import etree as ET
|
||||||
from openqa_client.client import OpenQA_Client
|
from openqa_client.client import OpenQA_Client
|
||||||
from osc.core import http_GET, makeurl
|
from osc.core import http_GET, makeurl
|
||||||
|
from random import randint
|
||||||
|
|
||||||
|
|
||||||
class BCIRepoPublisher(ToolBase.ToolBase):
|
class BCIRepoPublisher(ToolBase.ToolBase):
|
||||||
@ -59,7 +60,7 @@ class BCIRepoPublisher(ToolBase.ToolBase):
|
|||||||
return self.openqa.openqa_request('GET', 'jobs', values)['jobs']
|
return self.openqa.openqa_request('GET', 'jobs', values)['jobs']
|
||||||
|
|
||||||
def is_repo_published(self, project, repo, arch=None):
|
def is_repo_published(self, project, repo, arch=None):
|
||||||
"""Validates that the given prj/repo is fully published and all builds
|
"""Validate that the given prj/repo is fully published and all builds
|
||||||
have succeeded."""
|
have succeeded."""
|
||||||
result_filter = {'view': 'summary', 'repository': repo}
|
result_filter = {'view': 'summary', 'repository': repo}
|
||||||
if arch:
|
if arch:
|
||||||
@ -87,6 +88,8 @@ class BCIRepoPublisher(ToolBase.ToolBase):
|
|||||||
|
|
||||||
# Build the list of packages with metainfo
|
# Build the list of packages with metainfo
|
||||||
packages = []
|
packages = []
|
||||||
|
# List of packages that have passed openQA
|
||||||
|
openqa_passed_packages = []
|
||||||
# As long as it's the same everywhere, hardcoding this list here
|
# As long as it's the same everywhere, hardcoding this list here
|
||||||
# is easier and safer than trying to derive it from the package list.
|
# is easier and safer than trying to derive it from the package list.
|
||||||
for arch in ('aarch64', 'ppc64le', 's390x', 'x86_64'):
|
for arch in ('aarch64', 'ppc64le', 's390x', 'x86_64'):
|
||||||
@ -131,7 +134,7 @@ class BCIRepoPublisher(ToolBase.ToolBase):
|
|||||||
return
|
return
|
||||||
|
|
||||||
# Check openQA results
|
# Check openQA results
|
||||||
openqa_passed = True
|
mandatory_arches = ('aarch64', 'x86_64')
|
||||||
for pkg in packages:
|
for pkg in packages:
|
||||||
passed = 0
|
passed = 0
|
||||||
pending = 0
|
pending = 0
|
||||||
@ -146,20 +149,20 @@ class BCIRepoPublisher(ToolBase.ToolBase):
|
|||||||
else:
|
else:
|
||||||
self.logger.warning(f'https://openqa.suse.de/tests/{job["id"]} failed')
|
self.logger.warning(f'https://openqa.suse.de/tests/{job["id"]} failed')
|
||||||
failed += 1
|
failed += 1
|
||||||
|
if pending or failed:
|
||||||
if passed == 0 or pending > 0 or failed > 0:
|
self.logger.info(f'openQA did not (yet) pass for {pkg["name"]}: {passed}/{pending}/{failed}')
|
||||||
openqa_passed = False
|
continue
|
||||||
|
if passed == 0 and pkg['arch'] in mandatory_arches:
|
||||||
if not openqa_passed:
|
self.logger.info('No positive result from openQA (yet)')
|
||||||
self.logger.info('No positive result from openQA (yet)')
|
return
|
||||||
return
|
openqa_passed_packages.append(pkg)
|
||||||
|
|
||||||
# Trigger publishing
|
# Trigger publishing
|
||||||
if token is None:
|
if token is None:
|
||||||
self.logger.warning('Would publish now, but no token specified')
|
self.logger.warning(f'Would publish {[pkg["name"] for pkg in openqa_passed_packages]}, but no token specified')
|
||||||
return
|
return
|
||||||
|
|
||||||
for pkg in packages:
|
for pkg in openqa_passed_packages:
|
||||||
self.logger.info(f'Releasing {pkg["name"]}...')
|
self.logger.info(f'Releasing {pkg["name"]}...')
|
||||||
params = {
|
params = {
|
||||||
'project': pkg['build_prj'], 'package': pkg['name'],
|
'project': pkg['build_prj'], 'package': pkg['name'],
|
||||||
@ -173,10 +176,10 @@ class BCIRepoPublisher(ToolBase.ToolBase):
|
|||||||
raise RuntimeError(f'Releasing failed: {req.text}')
|
raise RuntimeError(f'Releasing failed: {req.text}')
|
||||||
|
|
||||||
self.logger.info('Waiting for publishing to finish')
|
self.logger.info('Waiting for publishing to finish')
|
||||||
for pkg in packages:
|
for pkg in openqa_passed_packages:
|
||||||
while not self.is_repo_published(pkg['publish_prj'], 'images'):
|
while not self.is_repo_published(pkg['publish_prj'], 'images'):
|
||||||
self.logger.debug(f'Waiting for {pkg["publish_prj"]}')
|
self.logger.debug(f'Waiting for {pkg["publish_prj"]}')
|
||||||
time.sleep(20)
|
time.sleep(randint(10, 30))
|
||||||
|
|
||||||
|
|
||||||
class CommandLineInterface(ToolBase.CommandLineInterface):
|
class CommandLineInterface(ToolBase.CommandLineInterface):
|
||||||
@ -194,8 +197,7 @@ class CommandLineInterface(ToolBase.CommandLineInterface):
|
|||||||
|
|
||||||
@cmdln.option('--token', help='The token for publishing. Does a dry run if not given.')
|
@cmdln.option('--token', help='The token for publishing. Does a dry run if not given.')
|
||||||
def do_run(self, subcmd, opts, project):
|
def do_run(self, subcmd, opts, project):
|
||||||
"""${cmd_name}: run the BCI repo publisher for the specified project,
|
"""${cmd_name}: run BCI repo publisher for the project, e.g. 15-SP5.
|
||||||
e.g. 15-SP3
|
|
||||||
|
|
||||||
${cmd_usage}
|
${cmd_usage}
|
||||||
${cmd_option_list}
|
${cmd_option_list}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user