Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added check slack channel in config, when get message #39

Merged
merged 1 commit into from Feb 25, 2019

Conversation

Projects
None yet
3 participants
@gimmetm
Copy link
Contributor

commented Feb 20, 2019

For cluster-channel pair use

@ssudake21 ssudake21 requested review from ssudake21 and PrasadG193 Feb 20, 2019

@PrasadG193

This comment has been minimized.

Copy link
Member

commented Feb 20, 2019

Hey @gimmetm,
Thanks for the PR 🙂

Looks like hack/verify-gofmt.sh is failing.

$ hack/verify-gofmt.sh
diff -u ./pkg/slack/slack.go.orig ./pkg/slack/slack.go
--- ./pkg/slack/slack.go.orig	2019-02-20 05:50:34.363532422 +0000
+++ ./pkg/slack/slack.go	2019-02-20 05:50:34.363532422 +0000
@@ -75,7 +75,7 @@
 				}
 				// if checkChannel is true
 				// Serve only if current channel is in config
-				if b.CheckChannel && (b.ChannelName != channel.Name){
+				if b.CheckChannel && (b.ChannelName != channel.Name) {
 					continue
 				}
 
@@ -90,7 +90,7 @@
 					}
 					// if checkChannel is true
 					// Serve only if current group is in config
-					if b.CheckChannel && (b.ChannelName != group.Name){
+					if b.CheckChannel && (b.ChannelName != group.Name) {
 						continue
 					}
 				}
Run ./hack/update-gofmt.sh
The command "hack/verify-gofmt.sh" failed and exited with 1 during .

Running hack/update-gofmt.sh should fix that.

@PrasadG193

This comment has been minimized.

Copy link
Member

commented Feb 20, 2019

  # Channels configuration
  communications:
    slack:
      channel: 'SLACK_CHANNEL'

@gimmetm, the communication.slack.channel in the configuration is only for restricting push notifications from BotKube. So as per the design, we should be able to execute kubectl commands from any channel, group (shared chat) or even from Direct Message to BotKube.
I am trying to understand what use case you are trying to solve?

@PrasadG193

This comment has been minimized.

Copy link
Member

commented Feb 20, 2019

BTW we are disabling notifier commands execution outside the channel as a part of separate issue

@gimmetm

This comment has been minimized.

Copy link
Contributor Author

commented Feb 20, 2019

if err == nil {
// Message posted in a group
// Serve only if starts with mention
if !strings.HasPrefix(ev.Text, "<@"+botID+"> ") {
continue
}
// if checkChannel is true
// Serve only if current group is in config
if b.CheckChannel && (b.ChannelName != group.Name) {

This comment has been minimized.

Copy link
@PrasadG193

PrasadG193 Feb 21, 2019

Member

@gimmetm can you please remove this check? We should be able to execute BotKube commands from group chats.

This comment has been minimized.

Copy link
@gimmetm

gimmetm Feb 21, 2019

Author Contributor

@PrasadG193 This check is for private channel. (https://api.slack.com/methods/groups.info)
group chat info might be in conversation.info or else.

@PrasadG193

This comment has been minimized.

Copy link
Member

commented Feb 21, 2019

Also, please squash your commits into one

@gimmetm gimmetm force-pushed the cloudsvcdev:checkchannel branch 2 times, most recently from 8c656b7 to f087541 Feb 21, 2019

Added check slack channel in config, when get message (for cluster-ch…
…annel pair use)

Replace slack api(channel.info, gruop.info) -> conversation.info

@gimmetm gimmetm force-pushed the cloudsvcdev:checkchannel branch from f087541 to 83d7f75 Feb 21, 2019

@PrasadG193

This comment has been minimized.

Copy link
Member

commented Feb 21, 2019

@gimmetm actually, client.GroupInfo() (https://godoc.org/github.com/nlopes/slack#Client.GetGroupInfo) returns true for a private channel as well as group chat. We need to find a better way to differentiate between them.

@gimmetm

This comment has been minimized.

Copy link
Contributor Author

commented Feb 21, 2019

@PrasadG193 I replaced GetChannelInfo&GetGroupInfo -> GetConversationInfo,
and checked (IsChannel, IsPrivate)
Please review it.

@PrasadG193

This comment has been minimized.

Copy link
Member

commented Feb 21, 2019

Nice! But still, group BotKube is not responding in group chat. Can you please test it on your setup?

@PrasadG193

This comment has been minimized.

Copy link
Member

commented Feb 25, 2019

@gimmetm actually, client.GroupInfo() (https://godoc.org/github.com/nlopes/slack#Client.GetGroupInfo) returns true for a private channel as well as group chat. We need to find a better way to differentiate between them.

Let's track this as a separate issue

@PrasadG193 PrasadG193 self-requested a review Feb 25, 2019

@PrasadG193 PrasadG193 merged commit aa72ab3 into infracloudio:master Feb 25, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.