From 28c7f111a67ba38a11607ef846fc265b413c1fcf Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sun, 24 Jun 2018 20:11:50 +0300 Subject: Change: set build exit code when an action ends, override later When a build action ends, we now set the *build* exit code to that of the action. Not for notification actions. This is all so that notifications can have the right exit code. --- ick2/buildsm.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'ick2') diff --git a/ick2/buildsm.py b/ick2/buildsm.py index 2e6d079..9177e09 100644 --- a/ick2/buildsm.py +++ b/ick2/buildsm.py @@ -122,6 +122,7 @@ class BuildStateMachine: return BUILD_NOTIFYING, (action_id, action) def mark_action_done(self, event): + self.build.resource['exit_code'] = event.exit_code graph = self.build.get_graph() graph.set_action_status(event.action_id, ick2.ACTION_DONE) graph.unblock() @@ -139,13 +140,15 @@ class BuildStateMachine: graph.append_action(action, ick2.ACTION_READY, depends=[]) def mark_notification_done(self, event): + if event.exit_code not in (0, None): # pragma: no cover + self.build.resource['exit_code'] = event.exit_code graph = self.build.get_graph() graph.set_action_status(event.action_id, ick2.ACTION_DONE) graph.unblock() if graph.has_more_to_do(): # pragma: no cover return BUILD_NOTIFYING, None - if self.build.resource.get('exit_code') is None: + if self.build.resource.get('exit_code') in (0, None): self.build.resource['exit_code'] = 0 return BUILD_DONE, None @@ -206,6 +209,7 @@ class ActionFinishedEvent(BuildEvent): def __init__(self, action_id): self.action_id = action_id + self.exit_code = 0 class ActionFailedEvent(BuildEvent): -- cgit v1.2.1