Skip to content

Commit f4d2817

Browse files
committed
[patch] implement broadcast
1 parent c25968f commit f4d2817

2 files changed

Lines changed: 19 additions & 9 deletions

File tree

.secrets.baseline

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"files": "^.secrets.baseline$",
44
"lines": null
55
},
6-
"generated_at": "2025-12-10T15:27:12Z",
6+
"generated_at": "2025-12-10T20:44:32Z",
77
"plugins_used": [
88
{
99
"name": "AWSKeyDetector"
@@ -82,15 +82,15 @@
8282
"hashed_secret": "053f5ed451647be0bbb6f67b80d6726808cad97e",
8383
"is_secret": false,
8484
"is_verified": false,
85-
"line_number": 42,
85+
"line_number": 54,
8686
"type": "Secret Keyword",
8787
"verified_result": null
8888
},
8989
{
9090
"hashed_secret": "4f75456d6c1887d41ed176f7ad3e2cfff3fdfd91",
9191
"is_secret": false,
9292
"is_verified": false,
93-
"line_number": 51,
93+
"line_number": 63,
9494
"type": "Secret Keyword",
9595
"verified_result": null
9696
}

bin/mas-devops-notify-slack

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,20 @@ def _getToolchainLink() -> str:
3030
return toolchainLink
3131
return ""
3232

33+
def _broadcast(channels: str, message: list):
34+
channelList = [ch.strip() for ch in channels.split(",")]
35+
responses = []
36+
for channel in channelList:
37+
try:
38+
response = SlackUtil.postMessageBlocks(channel, message)
39+
responses.append(response.data.get("ok", False))
40+
except Exception as e:
41+
print(f"Failed to send message to channel {channel}: {e}")
42+
responses.append(False)
43+
return all(responses) if responses else True
44+
3345

34-
def notifyProvisionFyre(channel: str, rc: int) -> bool:
46+
def notifyProvisionFyre(channels: str, rc: int) -> bool:
3547
"""Send Slack notification about Fyre OCP cluster provisioning status."""
3648
name = _getClusterName()
3749
toolchainLink = _getToolchainLink()
@@ -57,11 +69,10 @@ def notifyProvisionFyre(channel: str, rc: int) -> bool:
5769
SlackUtil.buildSection(f"<https://beta.fyre.ibm.com/development/vms|Fyre Dashboard>{toolchainLink}")
5870
]
5971

60-
response = SlackUtil.postMessageBlocks(channel, message)
61-
return response.data.get("ok", False)
72+
return _broadcast(channels, message)
6273

6374

64-
def notifyProvisionRoks(channel: str, rc: int, additionalDetails: str = "") -> bool:
75+
def notifyProvisionRoks(channels: str, rc: int, additionalDetails: str = "") -> bool:
6576
"""Send Slack notification about ROKS cluster provisioning status."""
6677
name = _getClusterName()
6778
toolchainLink = _getToolchainLink()
@@ -85,8 +96,7 @@ def notifyProvisionRoks(channel: str, rc: int, additionalDetails: str = "") -> b
8596
SlackUtil.buildSection(f"<https://cloud.ibm.com/kubernetes/clusters|IBM Cloud Dashboard>{toolchainLink}")
8697
]
8798

88-
response = SlackUtil.postMessageBlocks(channel, message)
89-
return response.data.get("ok", False)
99+
return _broadcast(channels, message)
90100

91101

92102
if __name__ == "__main__":

0 commit comments

Comments
 (0)