abi-checker: recognize staging
This commit is contained in:
parent
12b2bce785
commit
60e5fd94a2
23
ReviewBot.py
23
ReviewBot.py
@ -135,6 +135,18 @@ class ReviewBot(object):
|
|||||||
else:
|
else:
|
||||||
self.config = self._load_config()
|
self.config = self._load_config()
|
||||||
|
|
||||||
|
def has_staging(self, project):
|
||||||
|
try:
|
||||||
|
url = osc.core.makeurl(self.apiurl, ('staging', project, 'staging_projects'))
|
||||||
|
osc.core.http_GET(url)
|
||||||
|
return True
|
||||||
|
except HTTPError as e:
|
||||||
|
if e.code != 404:
|
||||||
|
self.logger.error('ERROR in URL %s [%s]' % (url, e))
|
||||||
|
raise
|
||||||
|
pass
|
||||||
|
return False
|
||||||
|
|
||||||
def staging_api(self, project):
|
def staging_api(self, project):
|
||||||
# Allow for the Staging subproject to be passed directly from config
|
# Allow for the Staging subproject to be passed directly from config
|
||||||
# which should be stripped before initializing StagingAPI. This allows
|
# which should be stripped before initializing StagingAPI. This allows
|
||||||
@ -184,6 +196,17 @@ class ReviewBot(object):
|
|||||||
with sentry_sdk.configure_scope() as scope:
|
with sentry_sdk.configure_scope() as scope:
|
||||||
scope.set_extra('request.id', self.request.reqid)
|
scope.set_extra('request.id', self.request.reqid)
|
||||||
|
|
||||||
|
# XXX: this is a hack. Annotating the request with staging_project.
|
||||||
|
# OBS itself should provide an API for that but that's currently not the case
|
||||||
|
# https://github.com/openSUSE/openSUSE-release-tools/pull/2377
|
||||||
|
if not hasattr(req, 'staging_project'):
|
||||||
|
staging_project = None
|
||||||
|
for r in req.reviews:
|
||||||
|
if r.state == 'new' and r.by_project and ":Staging:" in r.by_project:
|
||||||
|
staging_project = r.by_project
|
||||||
|
break
|
||||||
|
setattr(req, 'staging_project', staging_project)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
good = self.check_one_request(req)
|
good = self.check_one_request(req)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
@ -184,6 +184,8 @@ class ABIChecker(ReviewBot.ReviewBot):
|
|||||||
|
|
||||||
self.commentapi = CommentAPI(self.apiurl)
|
self.commentapi = CommentAPI(self.apiurl)
|
||||||
|
|
||||||
|
self.current_request = None
|
||||||
|
|
||||||
def check_source_submission(self, src_project, src_package, src_rev, dst_project, dst_package):
|
def check_source_submission(self, src_project, src_package, src_rev, dst_project, dst_package):
|
||||||
|
|
||||||
# happens for maintenance incidents
|
# happens for maintenance incidents
|
||||||
@ -199,6 +201,17 @@ class ABIChecker(ReviewBot.ReviewBot):
|
|||||||
# there were problems.
|
# there were problems.
|
||||||
ret = True
|
ret = True
|
||||||
|
|
||||||
|
if self.has_staging(dst_project):
|
||||||
|
# if staged we don't look at the request source but what
|
||||||
|
# is in staging
|
||||||
|
if self.current_request.staging_project:
|
||||||
|
src_project = self.current_request.staging_project
|
||||||
|
src_package = dst_package
|
||||||
|
src_rev = None
|
||||||
|
else:
|
||||||
|
self.logger.debug("request not staged yet")
|
||||||
|
return None
|
||||||
|
|
||||||
ReviewBot.ReviewBot.check_source_submission(self, src_project, src_package, src_rev, dst_project, dst_package)
|
ReviewBot.ReviewBot.check_source_submission(self, src_project, src_package, src_rev, dst_project, dst_package)
|
||||||
|
|
||||||
report = Report(src_project, src_package, src_rev, dst_project, dst_package, [], None)
|
report = Report(src_project, src_package, src_rev, dst_project, dst_package, [], None)
|
||||||
@ -514,6 +527,8 @@ class ABIChecker(ReviewBot.ReviewBot):
|
|||||||
|
|
||||||
self.dblogger.request_id = req.reqid
|
self.dblogger.request_id = req.reqid
|
||||||
|
|
||||||
|
self.current_request = req
|
||||||
|
|
||||||
self.reports = []
|
self.reports = []
|
||||||
self.text_summary = ''
|
self.text_summary = ''
|
||||||
try:
|
try:
|
||||||
@ -553,6 +568,8 @@ class ABIChecker(ReviewBot.ReviewBot):
|
|||||||
|
|
||||||
self.dblogger.request_id = None
|
self.dblogger.request_id = None
|
||||||
|
|
||||||
|
self.current_request = None
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
def check_request_already_done(self, reqid):
|
def check_request_already_done(self, reqid):
|
||||||
@ -901,24 +918,31 @@ class ABIChecker(ReviewBot.ReviewBot):
|
|||||||
|
|
||||||
# set of source repo name, target repo name, arch
|
# set of source repo name, target repo name, arch
|
||||||
matchrepos = set()
|
matchrepos = set()
|
||||||
for repo in root.findall('repository'):
|
# XXX: another staging hack
|
||||||
name = repo.attrib['name']
|
if self.current_request.staging_project:
|
||||||
path = repo.findall('path')
|
for node in root.findall("repository[@name='standard']/arch"):
|
||||||
if path is None or len(path) != 1:
|
|
||||||
self.logger.error("repo %s has more than one path"%name)
|
|
||||||
continue
|
|
||||||
prj = path[0].attrib['project']
|
|
||||||
if prj == 'openSUSE:Tumbleweed':
|
|
||||||
prj = 'openSUSE:Factory' # XXX: hack
|
|
||||||
if prj != dst_project:
|
|
||||||
continue
|
|
||||||
for node in repo.findall('arch'):
|
|
||||||
arch = node.text
|
arch = node.text
|
||||||
dstname = path[0].attrib['repository']
|
self.logger.debug('arch %s', arch)
|
||||||
if prj == 'openSUSE:Factory' and dstname == 'snapshot':
|
matchrepos.add(MR('standard', 'standard', arch))
|
||||||
dstname = 'standard' # XXX: hack
|
else:
|
||||||
if (dstname, arch) in dstrepos:
|
for repo in root.findall('repository'):
|
||||||
matchrepos.add(MR(name, dstname, arch))
|
name = repo.attrib['name']
|
||||||
|
path = repo.findall('path')
|
||||||
|
if path is None or len(path) != 1:
|
||||||
|
self.logger.error("repo %s has more than one path"%name)
|
||||||
|
continue
|
||||||
|
prj = path[0].attrib['project']
|
||||||
|
if prj == 'openSUSE:Tumbleweed':
|
||||||
|
prj = 'openSUSE:Factory' # XXX: hack
|
||||||
|
if prj != dst_project:
|
||||||
|
continue
|
||||||
|
for node in repo.findall('arch'):
|
||||||
|
arch = node.text
|
||||||
|
dstname = path[0].attrib['repository']
|
||||||
|
if prj == 'openSUSE:Factory' and dstname == 'snapshot':
|
||||||
|
dstname = 'standard' # XXX: hack
|
||||||
|
if (dstname, arch) in dstrepos:
|
||||||
|
matchrepos.add(MR(name, dstname, arch))
|
||||||
|
|
||||||
if not matchrepos:
|
if not matchrepos:
|
||||||
return None
|
return None
|
||||||
|
Loading…
x
Reference in New Issue
Block a user