Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/robusta/core/sinks/slack/slack_sink.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ class SlackSink(SinkBase):
params: SlackSinkParams

def __init__(self, sink_config: SlackSinkConfigWrapper, registry, is_preview=False):
slack_sink_params = sink_config.get_params()
slack_sink_params: SlackSinkParams = sink_config.get_params()
super().__init__(slack_sink_params, registry)
self.slack_channel = slack_sink_params.slack_channel
self.api_key = slack_sink_params.api_key
self.slack_sender = slack_module.SlackSender(
self.api_key, self.account_id, self.cluster_name, self.signing_key, self.slack_channel, registry, is_preview
self.api_key, self.account_id, self.cluster_name, self.signing_key, self.slack_channel, registry, is_preview, slack_sink_params.disable_holmes_note
)
self.registry.subscribe("replace_callback_with_string", self)

Expand Down
1 change: 1 addition & 0 deletions src/robusta/core/sinks/slack/slack_sink_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class SlackSinkParams(SinkBaseParams):
channel_override: Optional[str] = None
max_log_file_limit_kb: int = 1000
investigate_link: bool = True
disable_holmes_note: bool = False

@classmethod
def _supports_grouping(cls):
Expand Down
10 changes: 6 additions & 4 deletions src/robusta/integrations/slack/sender.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class SlackSender:
verified_api_tokens: Set[str] = set()
channel_name_to_id = {}

def __init__(self, slack_token: str, account_id: str, cluster_name: str, signing_key: str, slack_channel: str, registry, is_preview: bool = False):
def __init__(self, slack_token: str, account_id: str, cluster_name: str, signing_key: str, slack_channel: str, registry, is_preview: bool = False, disable_holmes_note: bool = False):
"""
Connect to Slack and verify that the Slack token is valid.
Return True on success, False on failure
Expand All @@ -84,6 +84,7 @@ def __init__(self, slack_token: str, account_id: str, cluster_name: str, signing
self.account_id = account_id
self.cluster_name = cluster_name
self.is_preview = is_preview
self.disable_holmes_note = disable_holmes_note

if slack_token not in self.verified_api_tokens:
try:
Expand Down Expand Up @@ -743,9 +744,10 @@ def __send_finding_to_slack(
blocks.append(DividerBlock())

is_holmes_slackbot_enabled = self.__is_holmes_slackbot_enabled()
holmes_block = self.get_holmes_block(platform_enabled, is_holmes_slackbot_enabled)
if holmes_block:
blocks.append(holmes_block)
if not self.disable_holmes_note:
holmes_block = self.get_holmes_block(platform_enabled, is_holmes_slackbot_enabled)
if holmes_block:
blocks.append(holmes_block)


if len(attachment_blocks):
Expand Down
Loading