Skip to content

Commit

Permalink
Merge branch 'master' into jobs_cache_init
Browse files Browse the repository at this point in the history
  • Loading branch information
arikalon1 authored May 21, 2024
2 parents b8b72f2 + f8c34ce commit d18e20a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/robusta/core/sinks/webhook/webhook_sink.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,17 @@ def __write_json(self, finding: Finding, platform_enabled: bool):
else:
break
if self.slack_webhook:
labels = message.get('subject', {}).get('labels')
if labels:
labels_as_text = ", ".join(f"{k}: {v}" for k, v in labels.items())
else:
labels_as_text = None
message = {
"text": f"*Title:* {message['title']}\n"
f"*Description:* {message['description']}\n"
f"*Failure:* {message['failure']}\n"
f"*Aggregation Key:* {message['aggregation_key']}\n"
f"*labels*: {labels_as_text}\n"
}
try:
r = requests.post(self.url, json=message, headers=self.headers)
Expand Down

0 comments on commit d18e20a

Please sign in to comment.