A shim to get webhook POSTs from Docker Hub and post them to Slack.
First, make a Dockerfile and add it to the root of your repository. You can test it locally with
sudo docker build .
after installing Docker.
Then push your project to Docker Hub.
Copy the webhook URL.
Set up dependencies:
sudo apt-get install python-requests python-twisted
Set shell variables for your webhook URL and a port (which can be any integer between 1024 and 65535; we have 8080 here as an example):
export slack_url='https://hooks.slack.com/services/PUT/YOURS/HERE'
export relay_port=8080
Clone this repo.
Make a file channel_selector.json
in the repo directory that maps the repo path on Docker Hub to a channel in your Slack chat.
For example, to map https://registry.hub.docker.com/u/psathyrella/ham/ and our C++ build environment to the relevant channels, the file would be:
{
"psathyrella/ham":"#bcell",
"matsengrp/cpp":"#infrastructure"
}
After running
python relay.py
visit http://your-webserver-goes-here.com:8080/relay and you should get the message "Relay is running."
Now, when your build pushes to Docker Hub you should get a nice notification in Slack.