Merge pull request #1669 from jberry-suse/repo_checker-multi-repository-request

repo_checker: include repository as bot name suffix for staging and direct package comments.
This commit is contained in:
Jimmy Berry 2018-08-23 08:01:15 -05:00 committed by GitHub
commit db50e7918b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -66,7 +66,7 @@ class RepoChecker(ReviewBot.ReviewBot):
state_hash = self.repository_state(repository_pairs) state_hash = self.repository_state(repository_pairs)
self.repository_check(repository_pairs, state_hash, False, bool(post_comments)) self.repository_check(repository_pairs, state_hash, False, bool(post_comments))
def package_comments(self, project): def package_comments(self, project, repository):
self.logger.info('{} package comments'.format(len(self.package_results))) self.logger.info('{} package comments'.format(len(self.package_results)))
for package, sections in self.package_results.items(): for package, sections in self.package_results.items():
@ -81,10 +81,11 @@ class RepoChecker(ReviewBot.ReviewBot):
'has installation issues and may not be installable:'.format( 'has installation issues and may not be installable:'.format(
project=project, package=package) project=project, package=package)
else: else:
bot_name_suffix = None bot_name_suffix = repository
comment_project = project comment_project = project
comment_package = package comment_package = package
message = 'This package has installation issues and may not be installable:' message = 'This package has installation issues and may not be installable from the `{}` ' \
'repository:'.format(repository)
# Sort sections by text to group binaries together. # Sort sections by text to group binaries together.
sections = sorted(sections, key=lambda s: s.text) sections = sorted(sections, key=lambda s: s.text)
@ -359,7 +360,7 @@ class RepoChecker(ReviewBot.ReviewBot):
return content.splitlines()[0] return content.splitlines()[0]
else: else:
comments = self.comment_api.get_comments(project_name=project) comments = self.comment_api.get_comments(project_name=project)
_, info = self.comment_api.comment_find(comments, self.bot_name) _, info = self.comment_api.comment_find(comments, '::'.join([self.bot_name, repository]))
if info: if info:
return info.get('state') return info.get('state')
@ -447,13 +448,14 @@ class RepoChecker(ReviewBot.ReviewBot):
# target project build phase. Once published update regardless. # target project build phase. Once published update regardless.
self.comment_write(state='seen', result='failed', project=project, self.comment_write(state='seen', result='failed', project=project,
message='\n'.join(comment).strip(), identical=True, message='\n'.join(comment).strip(), identical=True,
info_extra=info_extra, info_extra_identical=published) info_extra=info_extra, info_extra_identical=published,
bot_name_suffix=repository)
else: else:
# Post passed comment only if previous failed comment. # Post passed comment only if previous failed comment.
text = 'Previously reported problems have been resolved.' text = 'Previously reported problems have been resolved.'
self.comment_write(state='done', result='passed', project=project, self.comment_write(state='done', result='passed', project=project,
message=text, identical=True, only_replace=True, message=text, identical=True, only_replace=True,
info_extra=info_extra) info_extra=info_extra, bot_name_suffix=repository)
else: else:
text = '\n'.join(comment).strip() text = '\n'.join(comment).strip()
if not self.dryrun: if not self.dryrun:
@ -464,7 +466,7 @@ class RepoChecker(ReviewBot.ReviewBot):
print(text) print(text)
if post_comments: if post_comments:
self.package_comments(project) self.package_comments(project, repository)
if result and not published: if result and not published:
# Wait for the complete stack to build before positive result. # Wait for the complete stack to build before positive result.