⚠️ This service is currently not maintained - please reach out to the Keptn community via https://slack.keptn.sh if you want to take ownership of this repository and update it to make it work with the latest version of Keptn ⚠️
The notification-service is a Keptn service that is responsible for sending specific events as a notification to
- MS Teams
- Slack
- Webex Teams
Read an overview of this service in action on MS teams in this blog: Keptn now talks MS Teams: How we expand Keptn’s footprint in the Microsoft world
Watch this short YouTube video that demonstrates the setup and the Keptn notifications in action.
This notification service requires to be deployed into a Keptn environment and subscribes to the following Keptn Cloud Events:
- sh.keptn.event.configuration.change
- sh.keptn.events.deployment-finished
- sh.keptn.events.tests-finished
- sh.keptn.events.evaluation-done
- sh.keptn.events.problem
The service will send a notification to the configured notification provider (MS Teams, Slack, Webex Teams).
NOTE: The service will not send test-finished notification if teststrategy is empty
Please always double check the version of Keptn you are using compared to the version of this service, and follow the compatibility matrix below.
Keptn Version | Notification Service Image |
---|---|
0.5.x | keptncontrib/notification-service:0.2.0 |
0.6.x | keptncontrib/notification-service:0.3.0 |
0.7.x | keptncontrib/notification-service:0.3.1 |
develop | keptncontrib/notification-service:latest |
Please set up either Microsoft Teams, Slack or Webex Teams as described below.
All of these steps are done in Microsoft Teams client.
- Add a new team
- In the new team, add a new channel for the Keptn notifications. Save the new channel webhook URL
- In the new channel, add a new connector of type Webhook
- Others can join the channel too by first joining the team and adding the new channel
A keptn service that forwards events on keptn channels to a Slack channel using a webhook URL. To get your Slack Webhook URL please follow the instructions here: https://api.slack.com/incoming-webhooks
- Use an existing team or create a new team in the Webex Teams client
- Create a new space in the team
- Go to https://apphub.webex.com/teams/applications/incoming-webhooks-cisco-systems and login
- Create a Webhook by giving it a name and selecting the space you created before
- Copy the URL and insert it as described in 2.3
- You can invite members to this space or they can join by themselves
- Have a cluster with Keptn 0.6.0 installed
- Slack or Microsoft teams account with permission to add apps/teams/channels
- For development: Docker for running or building new images locally
- Make a copy of the deploy/notification-service.yaml file (Note: do not use right-click and download).
- Ensure you are installing the correct version of the notification service and adapt
the
image
in notification-service.yaml if necessary:containers: - name: notification-service image: keptncontrib/notification-service:0.3.1
- Furthermore, adjust these environment variables with the webhook URL of the service you want to send notifications to. Leave the value empty if the referenced service is not being used.
- name: TEAMS_URL value: "" - name: BRIDGE_URL value: "" - name: WEBEXTEAMS_URL value: ""
- Deploy services into cluster
kubectl apply -f notification-service.yaml -n keptn
using the file in this repo
- Now run Keptn pipelines and watch for the notifications in your team channel
- Validate cluster resources
kubectl -n keptn get pods
. You should see the pod running the service.
Use the keptn CLI to start a pipeline using the command keptn send event new-artifact. As the pipeline runs, it will send various cloud events like "configuration change" and "deployment finished"
- Clone this repo
- Run
npm install
to get all the requires modules - Start the service with
npm run start:dev
. This will update "on-the-fly" as you make file changes - Access the service at
http://localhost:8080
You can use the PostMan collection JSON file keptn-notifications.postman_collection.json
in this repo to test all the events.
To manually setup a request in a tool like Postman, use the following values.
- URL =
http://localhost:8080
- Content-Type = application/cloudevents+json
- Type = POST
- Raw Body for a Keptn deployment event
{ "type": "sh.keptn.event.configuration.change", "specversion": "0.2", "source": "https://github.com/keptn/keptn/cli", "id": "49ac0dec-a83b-4bc1-9dc0-1f050c7e781b", "time": "2019-06-07T07:02:15.64489Z", "contenttype": "application/json", "shkeptncontext":"49ac0dec-a83b-4bc1-9dc0-1f050c7e789b", "data": { "project": "sockshop", "stage": "staging", "service": "carts", "valuesCanary": { "image": "docker.io/keptnexamples/carts:0.9.1" } } }
You should get a HTTP 200 response code and see the notification in either Slack or Microsoft Teams.
- Run these commands after adjusting the repo, image name, and tag in this example
# build image docker build -t keptncontrib/notification-service:dev . # start image. Leave out environment variable for unwanted service docker run -p 8080:8080 -e TEAMS_URL="<Your URL>" -e SLACK_URL="your URL" keptncontrib/notification-service:dev
- Access the service at
http://localhost:8080
You are welcome to contribute using Pull Requests against the master branch. Before contributing, please read our Contributing Guidelines.
Travis is configured with CI to automatically build docker images for pull requests and commits. The pipeline can be viewed at https://travis-ci.org/keptn-contrib/notification-service.
The travis pipeline needs to be configured with the REGISTRY_USER
and REGISTRY_PASSWORD
variables.