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); }