From 6fac6409e59c94ee8da5f5800938279d0218a161 Mon Sep 17 00:00:00 2001 From: "n.pankin" Date: Thu, 6 Oct 2022 11:15:10 +0300 Subject: [PATCH] =?UTF-8?q?=D0=BC=D0=B5=D0=BD=D1=88=D0=B8=D0=BD=20=D0=B3?= =?UTF-8?q?=D1=80=D1=83=D0=BF=D0=BF=20=D1=81=D0=BB=D0=B0=D0=BA=20=D0=B2=20?= =?UTF-8?q?=D1=81=D0=BB=D1=83=D1=87=D0=B0=D0=B5=20=D0=B2=D0=BE=D0=B7=D0=BD?= =?UTF-8?q?=D0=B8=D0=BA=D0=BD=D0=BE=D0=B2=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BF?= =?UTF-8?q?=D1=80=D0=BE=D0=B1=D0=BB=D0=B5=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- atf.inc.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/atf.inc.php b/atf.inc.php index 10552df..3dc095f 100644 --- a/atf.inc.php +++ b/atf.inc.php @@ -836,11 +836,24 @@ class ATFPlan if($item['error'] == ATFTask::CODE_EXCEPTION) $slack_msg = "```$slack_msg```"; + $problem = $item['error'] == ATFTask::CODE_EXCEPTION || $item['error'] == ATFTask::CODE_STUCK; + $slack_msg = '('.round($item['time'],1).'s) '.$slack_msg.' *'.$task->device.'*'; - $resp = atf_slack_post($slack_msg, array('thread_ts' => $task->slack_thread_ts)); + $mentions = getor("ATF_PROBLEM_MENTION_GROUPS", null); + if($mentions !== null && $problem && strlen($mentions) > 0) + { + $mentions = explode(",", $mentions); + $groups = ""; + foreach($mentions as $mention) + $groups .= ' '; // - if(isset($resp['ok']) && $item['error'] == ATFTask::CODE_EXCEPTION || $item['error'] == ATFTask::CODE_STUCK) + if(strlen($groups) > 0) + $slack_msg = $groups."\n".$slack_msg; + } + + $resp = atf_slack_post($slack_msg, array('thread_ts' => $task->slack_thread_ts)); + if(isset($resp['ok']) && $problem) $this->session->tryShareToQAChannel($resp['ts'], $orig_msg); }