Slackira is a simple app to support slack to JIRA ticket comments by tagging a slack message with #slackira-<JIRA_TICKET_ID>
. There is also support to send a whole thread to the comment of a JIRA ticket by tagging the thread with #slackira@thread-<JIRA_TICKET_ID>
. NOTE: When using the thread tag, the message also needs to be posted to the channel to be picked up by Slackira.
Slackira, Slackira!
Slackira is configured as a cronjob to be run in kubernetes but can also be run locally using Node.
Slackira depends on the following environment variables for credentials and configuration:
- $SLACK_TOKEN # your slack access token
- $JIRA_USERNAME # jira username to post comments
- $JIRA_PASSWORD # jira password
- $JIRA_HOST # host for your jira account
- $ALL_CHANNELS # set to 'true' if you want to monitor all channels, this takes precedence over $SLACK_CHANNELS. NOTE: This does not include private channels.
- $SLACK_CHANNELS # comma-separated list of slack channels to monitor, this will be ignored if $ALL_CHANNELS is set to 'true'
- $FREQUENCY_IN_MINUTES # how often you want the cronjob to run, also how far back it looks on each run.
Requires:
- Docker
- Minikube
Requires:
- Node 10
- NPM
Ensure you have the environment variables set from the prerequisites section.
./bin/build-and-deploy.sh [FREQUENCY_IN_MINUTES=1]
NOTE: For FREQUENCY_IN_MINUTES, this script will first look for a value passed in at the command line, if none is there, it will look for an environment variable defined for FREQUENCY_IN_MINUTES and will finally default to every one minute if none is set.
Note, this only runs the job once and defaults to looking back 2 minutes.
npm install
npm start
TODO: add support to pass argument to npm start to configure how far back to query.
TODO: Add tests, fixtures have been added with sepia, a VCR library for Node TODO: Add a CI tool - Jenkins, Circle, etc
TODO: ADD cd script, for now it is best to edit the rendered kubernetes manifests from running locally using the ./bin/build-and-deploy.sh
script and push you locally built docker image to a repository.
Fork it and add a pull request!
Add support for an express server for Slack to push messages to Slackira rather than Slackira pulling from Slack. This was not implemented originally because the service had to sit behind a firewall to post to JIRA but we are unable to poke a hole in the firewall for Slack to hit publicly. Development of this feature would likely include running ngrok locally to create a tunnel with a public IP addess for Slack to hit.
The golang k8s CronJob Rest API Sidecar would comprise of a service account with access to the k8s api-server cronjob information and would expose that as a rest api for the cronjob to determine the last success time and can self-heal by picking up from the last successful run. This would allow the job to recover from longer lived failures.
- Dan Winter @danjwinter