No description
LICENSE | ||
README.md | ||
semaphore-webhook-server.py |
Semaphore Webhook Server
A small Python webservice to extend the API of Semaphore UI with a "webhook" enpoint to start tasks.
Installation
- Put the script onto your Semaphore server.
- Run it e.g. as a systemd service.
- Configure the reverse proxy to proxy a path of your choice to
http://localhost:3042/webhook
rather than Semaphore.-
Apache example:
ProxyPass /.well-known ! # Webhook server - must be before semaphre ProxyPass /webhook http://localhost:3042/webhook ProxyPassReverse /webhook http://localhost:3042/webhook # Semaphore ProxyPass /api/ws ws://localhost:3000/api/ws ProxyPass / http://localhost:3000/ ProxyPassReverse / http://localhost:3000/
-
Usage
The easiest to use this webhook endpoint, simply GET or POST the /webhook
endpoint with the project_id
and template_id
parameters:
GET /webhook?project_id=1&template_id=1 HTTP/1.1
Host: semaphore.example.org
Authorization: Bearer ...
These two parameters are required. The total set of supporter parameters are:
project_id
(required): inttemplate_id
(required): intdebug
: bool,true
orfalse
dry_run
: booldiff
: bool
Each request to the webhook server is transformed into a request to the Semaphore API's POST /project/{project_id}/tasks
endpoint.
The authorization header is passed on to Semaphore unmodified.