Skip to content
This repository has been archived by the owner on Oct 13, 2023. It is now read-only.

Commit

Permalink
Comment on pr - restrict to stream assembly (#765)
Browse files Browse the repository at this point in the history
  • Loading branch information
thegreyd committed Apr 28, 2023
1 parent 0cb733e commit e96a3b5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 4 additions & 0 deletions doozerlib/cli/__main__.py
Expand Up @@ -806,6 +806,10 @@ def images_build_image(runtime, repo_type, repo, push_to_defaults, push_to, scra
3. You will probably want to use --scratch since it is unlikely you want your
custom build tagged.
"""
if runtime.assembly != 'stream' and comment_on_pr:
runtime.logger.warning("Commenting on PRs is only supported for stream assembly")
comment_on_pr = False

# Initialize all distgit directories before trying to build. This is to
# ensure all build locks are acquired before the builds start and for
# clarity in the logs.
Expand Down
4 changes: 2 additions & 2 deletions doozerlib/distgit.py
Expand Up @@ -1056,10 +1056,10 @@ def wait(n):
comment_on_pr_obj.set_github_client()
comment_on_pr_obj.set_pr_from_commit()
# Message to be posted to the comment
message = Template("**[ART PR BUILD NOTIFIER]** _(beta)_\n\n"
message = Template("**[ART PR BUILD NOTIFIER]**\n\n"
"This PR has been included in build "
"[$nvr](https://brewweb.engineering.redhat.com/brew/buildinfo"
"?buildID=$build_id)"
"?buildID=$build_id) "
"for distgit *$distgit_name*. \n All builds following this will "
"include this PR.")
comment_on_pr_obj.post_comment(message.substitute(nvr=build_info["nvr"],
Expand Down
4 changes: 3 additions & 1 deletion tests/test_distgit/support.py
Expand Up @@ -95,8 +95,10 @@ def setUp(self):
Define and provide mock logging for test/response
"""
self.stream = io.StringIO()
logging.basicConfig(level=logging.DEBUG, stream=self.stream)
self.handler = logging.StreamHandler(self.stream)
self.logger = logging.getLogger()
self.logger.setLevel(logging.DEBUG)
self.logger.addHandler(self.handler)
self.logs_dir = tempfile.mkdtemp()
self.md = MockMetadata(MockRuntime(self.logger))

Expand Down

0 comments on commit e96a3b5

Please sign in to comment.