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 +++++- yarns/400-build.yarn | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) 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): diff --git a/yarns/400-build.yarn b/yarns/400-build.yarn index cef92e9..0d75ec0 100644 --- a/yarns/400-build.yarn +++ b/yarns/400-build.yarn @@ -343,7 +343,7 @@ The build status now shows the next step as the active one. ... } ... }, ... "status": "building", - ... "exit_code": null, + ... "exit_code": 0, ... "log": "/logs/rome/1" ... } ... ] -- cgit v1.2.1