Skip to content
This repository was archived by the owner on May 30, 2024. It is now read-only.

Commit df878a7

Browse files
author
Noah Lee
authored
Remove the Slack interaction (#275)
* Delete Chatops of Slack * Fix documents for Chatops * Remove `SLACK_SIGNING_SECRET` env
1 parent bc00580 commit df878a7

27 files changed

+31
-2414
lines changed

cmd/server/config.go

+5-6
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,10 @@ type (
4848
}
4949

5050
Slack struct {
51-
SlackClientID string `split_words:"true"`
52-
SlackClientSecret string `split_words:"true"`
53-
SlackSigningSecret string `split_words:"true"`
54-
SlackUserScopes []string `split_words:"true" default:""`
55-
SlackBotScopes []string `split_words:"true" default:"commands,chat:write"`
51+
SlackClientID string `split_words:"true"`
52+
SlackClientSecret string `split_words:"true"`
53+
SlackUserScopes []string `split_words:"true" default:""`
54+
SlackBotScopes []string `split_words:"true" default:"commands,chat:write"`
5655
}
5756

5857
Webhook struct {
@@ -88,7 +87,7 @@ func (c *Config) isGithubEnabled() bool {
8887
}
8988

9089
func (c *Config) isSlackEnabled() bool {
91-
return c.SlackClientID != "" && c.SlackClientSecret != "" && c.SlackSigningSecret != ""
90+
return c.SlackClientID != "" && c.SlackClientSecret != ""
9291
}
9392

9493
func (c *Config) hasTLS() bool {

cmd/server/main.go

-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ func newChatConfig(c *Config) *server.ChatConfig {
123123
Type: server.ChatTypeSlack,
124124
ClientID: c.SlackClientID,
125125
ClientSecret: c.SlackClientSecret,
126-
Secret: c.SlackSigningSecret,
127126
BotScopes: c.SlackBotScopes,
128127
UserScopes: c.SlackUserScopes,
129128
}

docs/concepts/chatops.md

-7
This file was deleted.

docs/concepts/notification.md

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Notification
2+
3+
Gitploy notifies users when deployments and reviews are created or updated. Now, Gitploy supports browser notification and Slack.
4+
5+
## Browser
6+
7+
Gitploy provides the browser notification to alert events as default. Almost modern browsers provide [notification API](https://developer.mozilla.org/ko/docs/Web/API/notification), but unfortunately, some browsers are not supported. To avoid browser compatibility, you can replace it with Slack.
8+
9+
*Note that if the notification doesn't work even though your browser provides it, you should check the setting that it is enabled or not.*
10+
11+
12+
## Slack
13+
14+
Slack is a popular messaging app for businesses globally. Gitploy supports Slack to notify events of deployments and reviews. You can figure out the Connect button on the settings page after integrating with Slack. Check [the documentation](../tasks/integration.md) for details.
15+
16+
Figure) Slack notification
17+
18+
![Slack Notification](../images/slack-notification.png)
-9.14 KB
Loading

docs/images/slack-deploy.png

-37.5 KB
Binary file not shown.

docs/images/slack-interactivity.png

-44.1 KB
Binary file not shown.

docs/images/slack-new-command.png

-32.5 KB
Binary file not shown.

docs/images/slack-notification.png

32.3 KB
Loading

docs/references/GITPLOY_SLACK_SIGNING_SECRET.md

-7
This file was deleted.

docs/references/configurations.md

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ Index of server configuration settings:
1818
* [GITPLOY_SERVER_PROTO](./GITPLOY_SERVER_PROTO.md)
1919
* [GITPLOY_SLACK_CLIENT_ID](./GITPLOY_SLACK_CLIENT_ID.md)
2020
* [GITPLOY_SLACK_CLIENT_SECRET](./GITPLOY_SLACK_CLIENT_SECRET.md)
21-
* [GITPLOY_SLACK_SIGNING_SECRET](./GITPLOY_SLACK_SIGNING_SECRET.md)
2221
* [GITPLOY_STORE_DRIVER](./GITPLOY_STORE_DRIVER.md)
2322
* [GITPLOY_STORE_SOURCE](./GITPLOY_STORE_SOURCE.md)
2423
* [GITPLOY_TLS_CERT](./GITPLOY_TLS_CERT.md)

docs/tasks/integration.md

+5-29
Original file line numberDiff line numberDiff line change
@@ -33,44 +33,20 @@ jobs:
3333

3434
## Slack
3535

36-
Slack integration provides Chatops (i.e. deploy, rollback) and notification alert for events.
36+
Slack integration provides notifications for events.
3737

3838
### Step 1: Create App
3939

40-
Firstly, we have to create [Slack App](https://api.slack.com/apps). Let’s click the Create App button and fill out inputs.
40+
Firstly, we have to create [Slack App](https://api.slack.com/apps). You should click the Create App button and fill out inputs.
4141

4242
### Step 2: Configure Permissions
4343

44-
After creating App let’s move to the *OAuth & Permissions* page. On this page, we have to set up *the redirect URLs* and *Bot Token scopes*. Firstly, let’s add a new redirect URL with the `GITPLOY_SERVER_PROTO://GITPLOY_SERVER_HOST/slack/signin` format; secondly, add `chat:write` and `commands` scopes into the Bot Token scopes.
44+
After creating App, we move to the *OAuth & Permissions* page and set up *the redirect URLs* and *Bot Token scopes*on this page. Firstly, you should add a new redirect URL with the `GITPLOY_SERVER_PROTO://GITPLOY_SERVER_HOST/slack/signin` format; secondly, add `chat:write` scope into the Bot Token scopes.
4545

4646
Figure) Slack Bot Token Scopes
4747

4848
![Slack Bot Token Sceops](../images/slack-bot-token-scopes.png)
4949

50-
### Step 3: Create Slash Command
51-
52-
To use the slash command, we have to create a new command, `/gitploy`. Move to the *Slash Commands* page, and fill out the "Create New Command" form like the following:
53-
54-
* Command: `/gitploy`
55-
* Request URL: `GITPLOY_SERVER_PROTO://GITPLOY_SERVER_HOST/slack/command`
56-
* Short Description: `Gitploy command`
57-
* Use Hint: `[deploy | rollback | help]`
58-
59-
Figure) Slack Create New Command
60-
61-
![Slack New Command](../images/slack-new-command.png)
62-
63-
### Step 4: Configure Interactivity
64-
65-
To enable the interactivity, we have to configure which URL interact with Slack. Move to the *Interactivity & Shortcuts* page, and fill out the "Request URL" with the `GITPLOY_SERVER_PROTO://GITPLOY_SERVER_HOST/slack/interact`
66-
67-
Figure) Slack Interactivity
68-
69-
![Slack Interactivity](../images/slack-interactivity.png)
70-
71-
### Step 5: Run Server With App Credentials
72-
73-
To enable Slack integration, you have to set up these environments when you run the server: `GITPLOY_SLACK_CLIENT_ID`, `GITPLOY_SLACK_CLIENT_SECRET`, and `GITPLOY_SLACK_SIGNING_SECRET`. You can get these credentials from *App Credentials* section of *Basic Information* page.
74-
75-
On settings page, you can find the button to connect with Slack. Now, you can run the slash command `/gitploy` in Slack.
50+
### Step 3: Run Server With App Credentials
7651

52+
To enable Slack integration, you have to set up these environments when you run the server: `GITPLOY_SLACK_CLIENT_ID` and `GITPLOY_SLACK_CLIENT_SECRET`. You can get these credentials from *App Credentials* section of *Basic Information* page.

internal/server/router.go

-7
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ type (
6363
Type ChatType
6464
ClientID string
6565
ClientSecret string
66-
Secret string
6766
BotScopes []string
6867
UserScopes []string
6968
}
@@ -219,10 +218,6 @@ func NewRouter(c *RouterConfig) *gin.Engine {
219218
if isSlackEnabled(c) {
220219
slackapi := r.Group("/slack")
221220
{
222-
m := s.NewSlackMiddleware(&s.SlackMiddlewareConfig{
223-
Interactor: c.Interactor,
224-
Secret: c.ChatConfig.Secret,
225-
})
226221
slack := s.NewSlack(&s.SlackConfig{
227222
ServerHost: c.Host,
228223
ServerProto: c.Proto,
@@ -232,8 +227,6 @@ func NewRouter(c *RouterConfig) *gin.Engine {
232227
slackapi.GET("", slack.Index)
233228
slackapi.GET("/signin", slack.Signin)
234229
slackapi.GET("/signout", slack.Signout)
235-
slackapi.POST("/interact", m.Verify(), m.ParseIntr(), m.SetChatUser(), slack.Interact)
236-
slackapi.POST("/command", m.Verify(), m.ParseCmd(), m.SetChatUser(), slack.Cmd)
237230
}
238231
}
239232

0 commit comments

Comments
 (0)