This is a couple of very rough python scripts that currently parse webhooks from Phabricator and Docker Hub, it then creates a message from that information and passes it on. Currently it sends the message to a Discord webhook and saves it as a json file. When parsing the Phabricator webhook it requests more information via the Conduit API. It currently supports Diffusion Commits, Differential Revisions, and Maniphest Tasks.
- Create a webhook and whatever rules to trigger it in Phabricator
- Set the webhook link to
http://yourserver:9000/hooks/phabricator
- Create a Phabricator API token for Conduit
- Create a webhook for your Docker Hub repository and set the webhook link to
http://yourserver:9000/hooks/dockerhub
- Create a Discord webhook
- Set a few environment variables in
docker-compose.yml
namely:PHABRICATOR_URL
- URL for the Phabricator instancePHABRICATOR_TOKEN
- Conduit API tokenDISCORD_URL
- Discord webhook URL
- Run
docker-compose up -d
This uses Adnanh Webhook for incoming webhooks. It weakly/barely authenticates the webhook, parses the json body for specific info, and passes that off to the relevant python script.
phabricator.py
will query Phabricator via a Conduit API wrapper for more information and bundle that into a message.
dockerhub.py
takes the Docker Hub information and bundles it into a message.
webactivity.py
is used to save messages to json files.
Discord notifications are sent using a Discord webhook API wrapper.
The Docker image is Alpine based and created using a multi-stage build in order to minimize its size. The Docker image is based on the one by almir.
The webhook examples folder has some examples of different webhooks to use for testing.