From 4b1627295d4611326aab7404a6e99f9001e0e2df Mon Sep 17 00:00:00 2001 From: hyokeun Date: Mon, 2 Jul 2018 12:44:54 +0900 Subject: [PATCH] Add last submitter when reporting ABS build error Change-Id: I1e3b3e7e1c4a6e2398680cd60be03afd704446c9 --- abs/job_abs_update.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/abs/job_abs_update.py b/abs/job_abs_update.py index b5ded07..31aaa78 100755 --- a/abs/job_abs_update.py +++ b/abs/job_abs_update.py @@ -70,6 +70,7 @@ def build_result_report(build_number): target = None branch = None obs_project = None + last_submitter_list = [] jenkins_server = Jenkins(os.getenv('JENKINS_URL'), os.getenv('JENKINS_USER'), os.getenv('JENKINS_PW')) build_abs = jenkins_server[os.getenv('JOB_NAME')].get_build(int(build_number)) @@ -86,7 +87,14 @@ def build_result_report(build_number): # parameters package = None project = None - for parm in single_build.get_actions().get('parameters'): + + act = single_build.get_actions() + if act.get('text') and act.get('text').startswith('Submitter: '): + single_submitter = act.get('text').split('Submitter: ')[-1] + if single_submitter not in last_submitter_list: + last_submitter_list.append(single_submitter) + + for parm in act.get('parameters'): if 'name' in parm and parm['name'] == 'TRIGGER_INFO': json = ast.literal_eval(base64.b64decode(parm.get('value')).replace('null', '\"none\"')) reason = json.get('full_build') @@ -156,6 +164,8 @@ def build_result_report(build_number): mailing_list = os.getenv('ABS_MAILINGLIST').split(',') mailing_list.extend(ast.literal_eval(os.getenv('ABS_MAILINGLIST_2')).get(obs_project).split(',')) + if len(last_submitter_list) > 0: + mailing_list.extend(last_submitter_list) mymail.add_receiver(filter(None, mailing_list)) mymail.send_mail() @@ -170,7 +180,7 @@ def main(new_rs, gerrit_name): if new_rs is None or new_rs == '' or gerrit_name is None or gerrit_name == '': ti = trigger_info(os.getenv('TRIGGER_INFO')) new_rs = ti.get('NEW_ROOTSTRAP') - gerrit_name = ti.get('NEW_ROOTSTRAP') + gerrit_name = ti.get('GERRIT_INFRA') assert new_rs assert new_rs.startswith('http') -- 2.7.4