Skip to content

Commit aa5d070

Browse files
committed
support multi-channel live standup configurations
1 parent 458bb61 commit aa5d070

603 files changed

Lines changed: 1037 additions & 167868 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env-example

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
DEBUG=true
2+
SLACK_BOT_TOKEN=
3+
SLACK_APP_TOKEN=
4+
S3_BRAIN_BUCKET=
5+
S3_BRAIN_KEY=brain.json

.gitignore

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
standup-bot
2-
.vscode
3-
.env.sh
4-
dist
1+
.env
2+
dist

.goreleaser.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,13 @@ dockers:
2121
- "justmiles/standup-bot:v{{ .Major }}"
2222

2323
skip_push: false
24-
use_buildx: false
24+
use: buildx
2525
extra_files:
2626
- go.mod
2727
- go.sum
2828
- LICENSE
2929
- main.go
3030
- lib
31-
- vendor
3231

3332
archives:
3433
- replacements:

Dockerfile

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
FROM golang:1.12-stretch as builder
1+
FROM golang:1.16-alpine
22

3-
COPY . /app
43
WORKDIR /app
5-
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo .
6-
RUN md5sum standup-bot
74

8-
# Create image from scratch
9-
FROM scratch
5+
COPY lib lib
6+
COPY go.mod go.mod
7+
COPY go.sum go.sum
8+
COPY main.go main.go
9+
COPY LICENSE LICENSE
1010

11-
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
12-
COPY --from=builder /app/standup-bot /standup-bot
13-
COPY --from=builder /tmp /tmp
11+
RUN go mod download
1412

15-
ENV AWS_DEFAULT_REGION us-east-1
13+
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo -o /standup-bot
1614

17-
ENTRYPOINT ["/standup-bot"]
15+
CMD [ "/standup-bot" ]

Makefile

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,18 @@
1-
VERSION=$$(git describe --tags $$(git rev-list --tags --max-count=1))
2-
3-
build:
4-
docker build . -t standup-bot
5-
61
run:
7-
docker run -it -e SSH_AUTH -e SLACK_TOKEN standup-bot
2+
go run main.go
83

9-
gen:
10-
go get github.com/abice/go-enum
11-
go-enum --file plugins/terraform/types.go
12-
13-
dev:
14-
# install justrun with
15-
# go get github.com/jmhodges/justrun
16-
17-
# Grab env configs
18-
# eval "$(get-ssm-params -path /ops/standup-bot -output shell)"
19-
justrun -c 'go run main.go' -delay 10000ms main.go lib/plugins/** lib/slack/*
4+
build:
5+
docker build -t standup-bot .
206

21-
push:
22-
# Push latest
23-
docker tag standup-bot:latest 965579072529.dkr.ecr.us-east-1.amazonaws.com/standup-bot:latest
24-
docker push 965579072529.dkr.ecr.us-east-1.amazonaws.com/standup-bot:latest
7+
docker-run:
8+
docker run \
9+
-it \
10+
--env-file .env \
11+
-e AWS_REGION \
12+
-e AWS_ACCESS_KEY_ID \
13+
-e AWS_SECRET_ACCESS_KEY \
14+
-e AWS_SESSION_TOKEN \
15+
-t standup-bot
2516

26-
# Push version
27-
docker tag standup-bot:latest 965579072529.dkr.ecr.us-east-1.amazonaws.com/standup-bot:$(VERSION)
28-
docker push 965579072529.dkr.ecr.us-east-1.amazonaws.com/standup-bot:$(VERSION)
17+
release:
18+
goreleaser --rm-dist

README.MD

Lines changed: 45 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,52 @@
1-
# standup-bot
1+
**Description**
22

3-
## Getting started
3+
This is a simple standup bot for slack.
44

5-
- [install go](https://golang.org/doc/install)
6-
- export any required environment variables
7-
- run with `make dev`
5+
**Setup**
86

9-
## Environment Configs
7+
1. Create standup bot with `app-manifest.yaml` file provided in the root of this directory
8+
1. Get bot and bot user tokens and set environment variables defined in `lib/config/main.go`
9+
1. Set up s3 bucket and provide AWS Creds if you would like standup settings to persists between restarts
1010

11-
If you set `SSM_PATH` config values are pull from SSM. Values in SSM are the same as below.
11+
**Docker**
1212

13-
- `SSM_PATH` - Pull configs from SSM using this SSM path
14-
- `SLACK_TOKEN` - API token used to auth against Slack as a bot user
15-
- `OAUTH_SLACK_TOKEN` - API token used to auth against Slack using oauth. Required for non-bot API scope
16-
- `SLACK_GROUP` - Name of Slack group containing participating users
17-
- `SLACK_CHANNEL` - Channel ID to post standup notes in
18-
- `CRON_SOLICIT_STANDUP` - cron expression in UTC to solicit for standup notes. example, "0 0 13 * * mon-fri", // 8AM central
19-
- `CRON_SHARE_STANDUP` - cron expression in UTC to share standup notes to the main channel. example, "0 0 13 * * mon-fri", // 8AM central
20-
- `STANDUP_MESSAGE` - optionally customize the message sent to users when soliciting for standup notes
21-
- `SHAME_PARTICIPANTS` - if set to "true" post a message when user doesn't particiapte in the standup
13+
```bash
14+
# quickstart
15+
docker run \
16+
-e SLACK_BOT_TOKEN=xoxb-blahblah \
17+
-e SLACK_APP_TOKEN=xapp-blahblah \
18+
-t justmiles/standup-bot
2219

23-
## Roadmap
20+
# with persistant brain
21+
docker run \
22+
-e SLACK_BOT_TOKEN=xoxb-blahblah \
23+
-e SLACK_APP_TOKEN=xapp-blahblah \
24+
-e S3_BRAIN_BUCKET=some_s3_bucket \
25+
-e S3_BRAIN_KEY=brain.json \
26+
-e AWS_REGION \
27+
-e AWS_ACCESS_KEY_ID \
28+
-e AWS_SECRET_ACCESS_KEY \
29+
-e AWS_SESSION_TOKEN \
30+
-t justmiles/standup-bot
31+
```
2432

25-
- [x] instead of sourcing partificpans by Slack Group, just message everyone in the `SLACK_CHANNEL`
26-
- [x] add property `STANDUP_MESSAGE` to customize the message sent to users when solociting standup notes
33+
**Configure your bot**
34+
35+
In slack just type `/standup`
36+
37+
**Test your bot**
38+
39+
In a channel type the below commands - this will create a mock standup with you as the sole participant.
40+
`/standup solicit`
41+
`/standup share`
42+
43+
**Users in multiple standups Scenarios**
44+
45+
If User recieves a standup solicitation from multiple channel configurations at the same time, then:
46+
- If User replies as normal, then both standups will receive the same notes.
47+
- If user replies in thread, then only the thread response will be used for the standup notes.
48+
49+
**Roadmap**
50+
51+
- Provide terraform module for quick setup in fargate
52+
- Update readme with a "how to"

app-manifest.yaml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
_metadata:
2+
major_version: 1
3+
minor_version: 1
4+
display_information:
5+
name: standup-bot
6+
description: An attempt at async standups,
7+
background_color: "#2e2e2e"
8+
features:
9+
app_home:
10+
home_tab_enabled: false
11+
messages_tab_enabled: true
12+
messages_tab_read_only_enabled: false
13+
bot_user:
14+
display_name: Standup Bot
15+
always_online: true
16+
slash_commands:
17+
- command: /standup
18+
description: Set standup settings for a given channel.
19+
should_escape: false
20+
oauth_config:
21+
scopes:
22+
user:
23+
- links:write
24+
bot:
25+
- app_mentions:read
26+
- channels:history
27+
- im:history
28+
- users:read
29+
- incoming-webhook
30+
- channels:read
31+
- im:read
32+
- team:read
33+
- usergroups:read
34+
- users.profile:read
35+
- chat:write
36+
- chat:write.public
37+
- groups:write
38+
- groups:read
39+
- im:write
40+
- groups:history
41+
- commands
42+
settings:
43+
event_subscriptions:
44+
bot_events:
45+
- app_mention
46+
- message.im
47+
- message.channels
48+
- message.groups
49+
interactivity:
50+
is_enabled: true
51+
org_deploy_enabled: false
52+
socket_mode_enabled: true
53+
token_rotation_enabled: false

go.mod

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,13 @@
11
module github.com/justmiles/standup-bot
22

3-
replace github.com/justmiles/standup-bot/lib/plugins => ./lib/plugins
3+
go 1.16
44

5-
replace github.com/justmiles/standup-bot/lib/slack => ./lib/slack
6-
7-
replace github.com/justmiles/standup-bot/lib/configs => ./lib/configs
8-
9-
replace github.com/justmiles/standup-bot/lib/standup => ./lib/standup
10-
11-
go 1.15
5+
replace github.com/justmiles/standup-bot/lib/standup => ./standup
126

137
require (
14-
github.com/aws/aws-sdk-go v1.37.21
15-
github.com/dustin/go-humanize v1.0.0
16-
github.com/go-chat-bot/bot v0.0.0-20201004141219-763f9eeac7d5
17-
github.com/go-chat-bot/plugins v0.0.0-20201024114236-00ff43fcf77f
8+
github.com/aws/aws-sdk-go v1.41.4
9+
github.com/chrispruitt/go-slackbot v0.3.2
1810
github.com/lucasb-eyer/go-colorful v1.2.0
19-
github.com/slack-go/slack v0.8.1
11+
github.com/sirupsen/logrus v1.8.1
12+
github.com/slack-go/slack v0.9.4
2013
)

0 commit comments

Comments
 (0)