Slack app
Description
Developers want to be able to issue commands to GitLab via a chat interface (aka ChatOps). Let's provide an MVP of a GitLab integration to Slack.
As a developer and product manager, I really like the slash commands integration (from https://gitlab.com/gitlab-org/gitlab-ce/issues/19838) better than bot integration. The slash commands feel more natural with Slack. I don't feel any benefit by having a "bot" that I can talk with, @ mention, etc. Also, Slack allows deeper integration via Apps than a bot can do. For example, an app can respond with a question and have buttons the user can click on to pick an answer. It can also do OAuth to easily connect your Slack account with your GitLab account on first usage. The app backend could exist in the main Rails app of GitLab without requiring additional containers/processes/configuration. We could add the GitLab.com app to the Slack app catalog so everyone can install it easily. Single-tenant GitLab installs would have a Slack app install button somewhere to make it easy to install with a click or two.
[Edit: @zj brought up a good reason for having a "bot" which is to be able to direct message to it for queries without bothering a chat room with the conversation. Luckily a direct Slack integration still allows for a "bot" interaction if we want.]
However, we believe that Cog is the long-term answer for ChatOps because DevOps want to be able to customize their scripts. Unfortunately, it's complicated and risky for us to ship Cog with GitLab. e.g. Cog is optimized around Docker and doesn't fit well with GitLab Omnibus. So we're starting with a direct Slack integration. Perhaps this will only live for a release or two and be replaced by Cog, or perhaps Cog will turn into a dead end. Or maybe both solutions will live because they serve different needs. We just don't know, but this seems like the simplest way forward and well know more at the end of it.
Proposal
- Add a Slack app backend to GitLab CE
- Add a button into GitLab to install the Slack app
- Support OAuth dance with Slack when new users first issue a GitLab command
- List the Slack app for GitLab.com in the Slack app catalog
- Support various slash commands (e.g.
/issue
,/deploy
). Potential (incomplete) vocabulary:/project create
/issue create [issue_title] [from last N]
/issue add [from PERSON]
/issue open [ISSUE]
/deploy staging production
/deploy v8.10.0 production
/deploy BRANCH ENVIRONMENT
/rollback [ENVIRONMENT]
- [optional] Provide bot for direct messages
- [stretch] Use Slack username in notifications #20151 (moved)
- [stretch] CI and CD notifications via App instead of Service
Questions:
- Can installations of GitLab self-register their own app or does this have to be done via the Slack website? (This could be a deal-breaker)
- What is the mapping between Slack teams/rooms and GitLab installations/teams/projects?
- Apparently it's hard for us to map anything to a group, so we might have to do installation-wide or per-project integrations. Connecting projects to rooms might be our first iteration.
- Is there any advantage in using a separate process to receive the Slack webhooks vs a new endpoint in GitLab?
Links
- [UX Demo] Cog stubbed plugin
- Stubbed Slack bot from Vision Demo: https://gitlab.com/markpundsack/gitlab-bot
- [Ship Cog with GitLab](From https://gitlab.com/gitlab-org/omnibus-gitlab/issues/1412#note_13763580)
- GitLab chat bot (Cog bundle)
- Slack channel