Bare-bones continuous integration using Docker Hub and Slack.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
README.md
relay.py

README.md

relay

A shim to get webhook POSTs from Docker Hub and post them to Slack.

Setup

Put your project up on Docker Hub

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.

Make a new Incoming Webhook in Slack's Integrations

Copy the webhook URL.

Webserver-side configuration

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"
}

Run

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.