Slack/Mattermost Integration for notifying Jira events, ready on Docker/Kubernetes and App Engine
Branch: master
Clone or download
Latest commit cfad961 Dec 4, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
appengine
formatter
handlers
jira
testdata
.editorconfig Refactor Jun 29, 2018
.gitignore Refactor Dec 4, 2018
Dockerfile
LICENSE Create LICENSE Jan 26, 2018
README.md
go.mod
go.sum
main.go
main_test.go

README.md

jira-to-slack CircleCI

This is a Slack and Mattermost integration for notifying JIRA events. It is written in Go and runnable on App Engine.

Examples

Slack

jira-to-slack

Mattermost

jira-to-mattermost

Getting Started

Setup Slack or Mattermost

Create an Incoming Webhook on your Slack or Mattermost.

Setup JIRA Webhook

Create a Webhook on your JIRA cloud or server.

jira-webhook-setup

Set the URL of Webhook as follows:

https://jira-to-slack.appspot.com/?webhook=https://hooks.slack.com/xxx

You can add the following query parameters:

Name Value Default Example
webhook Slack Webhook URL Mandatory https://hooks.slack.com/xxx
username BOT username - JIRA
icon BOT Icon emoji or URL - :speech_baloon: or https://.../jira.png
dialect API dialect slack slack or mattermost
debug Dump JIRA and Slack messages to console 0 0 or 1

You can deploy jira-to-slack on your server as well. See the later section for details.

Deploy

Standalone

Download the latest release and run the server:

./jira-to-slack

Docker

You can run the server on Docker:

docker run --rm -p 3000:3000 int128/jira-to-slack

App Engine

You can deploy on App Engine:

# Install SDK
brew cask install google-cloud-sdk
gcloud components install app-engine-go

# Run
dev_appserver.py appengine/app.yaml

# Deploy
gcloud app deploy --project=jira-to-slack appengine/app.yaml

Kubernetes

You can install the Kubernetes Helm Chart:

git clone https://github.com/int128/devops-kompose && cd devops-kompose
export DEVOPS_DOMAIN=dev.example.com
helmfile -l name=jira-to-slack sync

How it works

Triggers

jira-to-slack sends a message to the Slack channel on the following triggers:

  • Someone created an issue.
  • Someone commented to an issue.
  • Someone assigned an issue.
  • Someone updated summary or description of an issue.
  • Someone deleted an issue.

Mentions

jira-to-slack sends mentions to reporter and assignee of the issue.

If the issue or comment has mentions (Slack style @foo or JIRA style [~foo]), jira-to-slack sends the mentions as well.

Other solutions

JIRA Mattermost Webhook Bridge. Great work. This is almost perfect but notifies many events so it may be noisy.

Mattermost official JIRA Webhook Plugin. This is still beta and in progress. Currently this does not notify comment.

Contribution

This is an open source software licensed under Apache License 2.0. Feel free to open your issues or pull requests.

Development

Start the server:

go run main.go

App Engine:

dev_appserver.py --port 3000 appengine/app.yaml

E2E Test

You can send actual payloads of actual JIRA events by the following script:

# Slack
SLACK_WEBHOOK="https://hooks.slack.com/xxx&username=JIRA&icon=https://lh3.googleusercontent.com/GkgChJMixx9JAmoUi1majtfpjg1Ra86gZR0GCehJfVcOGQI7Ict_TVafXCtJniVn3R0" ./testdata/post_jira_events.sh

# Mattermost
SLACK_WEBHOOK="https://mattermost.example.com/hooks/xxx&username=JIRA&icon=https://lh3.googleusercontent.com/GkgChJMixx9JAmoUi1majtfpjg1Ra86gZR0GCehJfVcOGQI7Ict_TVafXCtJniVn3R0&dialect=mattermost" ./testdata/post_jira_events.sh