From e8d978342b02d5d4a22bbb8374bd1c92dc81dd1e Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sun, 24 Jun 2018 19:37:32 +0300 Subject: Change: mangle build status for notifications --- ick2/actions.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/ick2/actions.py b/ick2/actions.py index 3d77aa5..8c52475 100644 --- a/ick2/actions.py +++ b/ick2/actions.py @@ -14,6 +14,7 @@ import base64 +import copy import json import os import tempfile @@ -496,7 +497,7 @@ class NotifyAction(Action): # pragma: no cover notify = { 'recipients': recipients, - 'build': build, + 'build': self.mangle_build(build), 'log': log, } @@ -504,6 +505,17 @@ class NotifyAction(Action): # pragma: no cover env.report(0, 'Notified about build {} ending\n'.format(build_id)) + def mangle_build(self, build): + b = copy.deepcopy(build) + exit_code = build.get('exit_code') + if exit_code is None: + b['status'] = 'BUILDING' + elif exit_code == 0: + b['status'] = 'SUCCESS' + else: + b['status'] = 'FAILED' + return b + def make_directory_empty(env, dirname): return env.runcmd( -- cgit v1.2.1