Skip to content

Commit

Permalink
Lint and rework comments on code
Browse files Browse the repository at this point in the history
  • Loading branch information
tcarmet committed Mar 6, 2024
1 parent 46f8799 commit 5407da6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
1 change: 1 addition & 0 deletions bert_e/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ class QueueBuildFailedMessage(TemplateException):
code = 136
template = "queue_build_failed.md"


# internal exceptions
class UnableToSendEmail(InternalException):
code = 201
Expand Down
7 changes: 0 additions & 7 deletions bert_e/workflow/gitwaterflow/branches.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,13 +551,6 @@ def validate(self):
@property
def failed_prs(self):
"""Return a list PRs in which the build have failed in the queue."""
# TODO: Review if we should include the list of branches in the returned
# list of failed PRs. (To be used in the template to notify the user).
# Currently the drawback is that if the template changes a lot
# (one branch mentioned then two, then back to one)
# we will be sending multiple notifications to the user, with no good reason sometimes.
# But at the same time if we don't send them in some cases, the user will not be aware of
# the issue.
if not self._validated:
raise errors.QueuesNotValidated()

Expand Down
10 changes: 9 additions & 1 deletion bert_e/workflow/gitwaterflow/queueing.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

from bert_e import exceptions
from bert_e.job import handler as job_handler
from bert_e.job import QueuesJob, PullRequestJob, Job
from bert_e.job import QueuesJob, PullRequestJob
from bert_e.lib import git

from ..git_utils import clone_git_repo, consecutive_merge, robust_merge, push
Expand All @@ -36,6 +36,14 @@

def notify_queue_build_failed(failed_prs: List[int], job: QueuesJob):
"""Notify on the pull request that the queue build failed."""
# TODO: As this feature evolves, we might want to include
# the list of failed q/ branches in the message.
# Currently the drawback is that if the template changes a lot
# (one branch mentioned then two, then back to one)
# we will be sending multiple notifications to the user,
# in some cases with no good reason, and in other cases with a good reason.
# This becomes less of an issue if we focus on notifying the user
# only through build status checks.
for pr_id in failed_prs:
pull_request = job.project_repo.get_pull_request(pr_id)
send_comment(
Expand Down

0 comments on commit 5407da6

Please sign in to comment.