A modification of Triggerer to listen for GitLab pushes.
Find a file
2018-02-25 10:41:34 +02:00
config Initial commit 2018-02-25 00:26:58 +02:00
lib Rename files to fit project 2018-02-25 10:41:34 +02:00
rel Initial commit 2018-02-25 00:26:58 +02:00
test Rename files to fit project 2018-02-25 10:41:34 +02:00
.formatter.exs Initial commit 2018-02-25 00:26:58 +02:00
.gitignore Initial commit 2018-02-25 00:26:58 +02:00
.gitlab-ci.yml Add test CI 2018-02-25 00:39:24 +02:00
.on-save.json Initial commit 2018-02-25 00:26:58 +02:00
LICENSE Add LICENSE 2018-02-24 22:56:10 +00:00
mix.exs Rename files to fit project 2018-02-25 10:41:34 +02:00
mix.lock Initial commit 2018-02-25 00:26:58 +02:00
README.md Rename files to fit project 2018-02-25 10:41:34 +02:00

GitLabPushTriggerer

GitLabPushTriggerer is a small application that triggers execution of scripts when given endpoints are hit with GET requests. It contains no permissions handling, no authentication, no request limiting. So these must be handled in some other way, like with an Nginx reverse proxy.

Should work on any *nix system that has sh.

Installation

  1. Clone repo
  2. mix deps.get
  3. Build release with MIX_ENV=prod COOKIE=yourcookie mix release --env=prod
  4. Run release in your preferred way, setting environment according to the next section

Environment variables

To bind to a certain port (instead of default 6000), add env PORT=1337.

Configuration of endpoints and scripts is done via environment variables. Environment variables are set in the following format:

TRIGGERER_FOO=/path/to/bar.sh

The variable consists of TRIGGERER_ prefix, after which is the name of the endpoint. The value is the path to the script to execute. The above variable would result in an endpoint /foo, which would execute /path/to/bar.sh.

The endpoint path is transformed to lowercase and underscores are replaced with dashes. See the following examples:

  • TRIGGERER_FOO/foo
  • TRIGGERER_CODE_STATS_BETA/code-stats-beta
  • TRIGGERER_AAA_/aaa-

The path to the script can be absolute or relative, as long as it can be reached from the current working dir.

Return value

If the script was triggered, 200 OK is returned. If the script is not found or the request path is wrong, 404 File not found is returned. If there is an error in script execution, 500 Internal server error is returned and the error is logged.