меншин групп слак в случае возникновения проблем

This commit is contained in:
n.pankin 2022-10-06 11:15:10 +03:00
parent f511d19d52
commit 6fac6409e5
1 changed files with 15 additions and 2 deletions

View File

@ -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 .= '<!subteam^'.$mention.'> '; //<!subteam^ID>
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);
}