Webhook receiver for Git deployments
Project description
Webhook receiver for Git deployments
This project started as a dirty & quick hack to perform some deployment actions triggered by a Git webhook.
I looked a little bit at other projects and didn't found any one that suited my needs, so I started this project... and then it grew a little bit and become something more versatile than the quick hack originally intended.
This project is aimed at DevOps or sysadmin that have git repositories, typically with a VIP-branch, and automatic deployment. You may want to have different branches for stage and production or set up push permissions differently to the different branches. This utility, when a webhook is received, will update the local Git repository and perform the commands in the settings.
Quickstart
- Create and activate a Virtual Environment:
virtualenv --python=/usr/bin/python3 /path/to/venv
source /path/to/venv/bin/activate
- Install the package:
pip install webhooks_git_automata
- Create a
settings.yaml
- Set up a service (e.g. a systemd service file) that does something along:
/path/to/venv/bin/wh-gitd /path/to/settings.yaml
Settings
Implementation details
This project contains a minimal Flask server that answers the POST webhooks sent
by a Git server like GitLab, GitHub or Gogs. The server is started through the
Flask's app.run
method.
Not a lot of traffic is expected, but you may want to set up a reverse proxy in front of the Flask server, or add some fancier method like a WSGI or uWSGI or similar layer.
Typical git servers expect the webhook to send a quick reply (in general, HTTP
connections are intended to be short lived) so there is a worker/tasks approach. There
is a very simple implementation base on Threading
and a shared Queue
. More complex
implementations may be added in the future (pull requests welcome).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file webhooks_git_automata-0.0.1.tar.gz
.
File metadata
- Download URL: webhooks_git_automata-0.0.1.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.5.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
256eddc1ad4fa9e55c04b47cb581d8450af883c91673e8ddf0a131fcc6fe6ebb
|
|
MD5 |
3bc2d3113a9b6d2dafc8239fd8f8b2bb
|
|
BLAKE2b-256 |
a1b529eb9b8324bd96f15d01c21c5ec81eeaeff4c9be8c84a16dceea4ef00ae5
|
File details
Details for the file webhooks_git_automata-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: webhooks_git_automata-0.0.1-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.5.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
39faad4482f93fcb6a9c3a0dac6ecca5b26112b0cb995533d016f9990cd52f5f
|
|
MD5 |
81ba9cbf3927be9aa18ef58ff85d1a18
|
|
BLAKE2b-256 |
a5332f41df83dc118afadb777e53b1a097791ba6509722bc394121fc800f35ca
|