Add offline runners info in the Slack report (#19169)

* send slack report for offline runners

Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
This commit is contained in:
Yih-Dar
2022-09-23 19:23:05 +02:00
committed by GitHub
parent 49bf569830
commit 0cea8d5555
3 changed files with 34 additions and 3 deletions

View File

@@ -397,8 +397,12 @@ class Message:
ci_title_block = {"type": "section", "text": {"type": "mrkdwn", "text": ci_title}}
blocks.append(ci_title_block)
offline_runners = []
if runner_not_available:
text = "💔 CI runners are not available! Tests are not run. 😭"
result = os.environ.get("OFFLINE_RUNNERS")
if result is not None:
offline_runners = json.loads(result)
elif runner_failed:
text = "💔 CI runners have problems! Tests are not run. 😭"
elif setup_failed:
@@ -413,11 +417,18 @@ class Message:
"text": text,
},
}
text = ""
if len(offline_runners) > 0:
text = "\n" + "\n".join(offline_runners)
text = f"The following runners are offline:\n{text}\n\n"
text += "🙏 Let's fix it ASAP! 🙏"
error_block_2 = {
"type": "section",
"text": {
"type": "plain_text",
"text": "🙏 Let's fix it ASAP! 🙏",
"text": text,
},
"accessory": {
"type": "button",