From 78e11431dbc8ebbaec73e64b55c6edfbf73192af Mon Sep 17 00:00:00 2001 From: Karsten Hopp Date: May 22 2019 11:48:31 +0000 Subject: Add commit hash to comment This allows pagure to display the git hash for CI results Signed-off-by: Karsten Hopp --- diff --git a/playbooks/roles/flag_ci_pr/files/flag_ci_pr.py b/playbooks/roles/flag_ci_pr/files/flag_ci_pr.py index 66a74e7..4c35376 100644 --- a/playbooks/roles/flag_ci_pr/files/flag_ci_pr.py +++ b/playbooks/roles/flag_ci_pr/files/flag_ci_pr.py @@ -58,6 +58,10 @@ def main(msg, pipeline_state='complete', seed='empty'): status = done_states[state]['api'] human_status = done_states[state]['human'] + if 'commit_hash' in msg: + commit_hash_text = ' for %s' % msg['commit_hash'][:8] + else: + commit_hash_text = '' # test running messages elif pipeline_state == 'running': @@ -74,7 +78,7 @@ def main(msg, pipeline_state='complete', seed='empty'): data = { 'username': 'Fedora CI', 'status': status, - 'comment': 'Package tests: %s' % human_status, + 'comment': 'Package tests%s: %s' % (commit_hash_text,human_status), 'url': msg['build_url'], 'uid': hashlib.md5(pr_id + seed).hexdigest() }