Skip to content

Commit 8e4bd49

Browse files
committed
Interpret any non empty non success workflow conclusion as FAIL
Make logging_wrapper skip itself as a caller
1 parent 29fa65e commit 8e4bd49

File tree

3 files changed

+14
-25
lines changed

3 files changed

+14
-25
lines changed

src/redis_release/bht/behaviours.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -799,6 +799,11 @@ def update(self) -> Status:
799799
):
800800
self.logger.info(f"Workflow completed with success status")
801801
return Status.SUCCESS
802+
elif self.workflow.conclusion == WorkflowConclusion.FAILURE:
803+
if self.log_once(
804+
"workflow_unsuccessful", self.workflow.ephemeral.log_once_flags
805+
):
806+
self.logger.error(f"Workflow completed with failure status")
802807
return Status.FAILURE
803808

804809

src/redis_release/bht/logging_wrapper.py

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -35,33 +35,17 @@ def __init__(self, logger: logging.Logger) -> None:
3535
self._logger = logger
3636

3737
def debug(self, msg: str) -> None:
38-
"""Log a message with severity 'DEBUG'.
39-
40-
Args:
41-
msg: The message to log
42-
"""
43-
self._logger.debug(msg)
38+
"""Log a message with severity 'DEBUG'."""
39+
self._logger.debug(msg, stacklevel=2)
4440

4541
def info(self, msg: str) -> None:
46-
"""Log a message with severity 'INFO'.
47-
48-
Args:
49-
msg: The message to log
50-
"""
51-
self._logger.info(msg)
42+
"""Log a message with severity 'INFO'."""
43+
self._logger.info(msg, stacklevel=2)
5244

5345
def warning(self, msg: str) -> None:
54-
"""Log a message with severity 'WARNING'.
55-
56-
Args:
57-
msg: The message to log
58-
"""
59-
self._logger.warning(msg)
46+
"""Log a message with severity 'WARNING'."""
47+
self._logger.warning(msg, stacklevel=2)
6048

6149
def error(self, msg: str) -> None:
62-
"""Log a message with severity 'ERROR'.
63-
64-
Args:
65-
msg: The message to log
66-
"""
67-
self._logger.error(msg)
50+
"""Log a message with severity 'ERROR'."""
51+
self._logger.error(msg, stacklevel=2)

src/redis_release/github_client_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ async def get_workflow_run(self, repo: str, run_id: int) -> WorkflowRun:
334334
conclusion = None
335335
if github_conclusion == "success":
336336
conclusion = WorkflowConclusion.SUCCESS
337-
elif github_conclusion == "failure":
337+
elif github_conclusion is not None:
338338
conclusion = WorkflowConclusion.FAILURE
339339

340340
workflow_name = data.get("name", "unknown")

0 commit comments

Comments
 (0)