A really simple webhook receiver.
Go to file
2021-07-29 08:29:37 +01:00
config.json Rewrite how tests are defined 2021-07-29 07:42:02 +01:00
Dockerfile Add Dockerfile 2021-07-29 08:09:04 +01:00
example.sh Initial commit 2021-07-28 16:20:06 +01:00
go.mod Fix module name 2021-07-29 07:37:18 +01:00
go.sum Initial commit 2021-07-28 16:20:06 +01:00
main.go fix signature comparison logic 2021-07-29 08:29:37 +01:00
readme.md Make enpoint prefix plural, change stuff in readme 2021-07-29 07:54:22 +01:00

gohookr

A really simple webhook receiver, which listens at 0.0.0.0:<port>/webhooks/<webhook-name>.

Default port is 80 and can be overriden by setting the environment variable PORT.

Default config path is /etc/gohookr.conf and can be overriden by setting environment variable CONFIG.

Check below for an example configuration.

Signature Verification

Signature verificaiton is done using SHA256 HMACs. You must set which HTTP header gohookr will receive a signature from using the SignatureHeader key for each service. You should also specify a shared secret in the Secret key.

Disable Signature Verification

You can disable signature verification altogether by setting environment variable NO_SIGNATURE_VERIFICATION to true.

Tests

gohookr can run test before running your script. Tests must be in the form of bash scripts. A non-zero return code is considered a fail and gohookr will run no further tests and will not deploy.

Tests are run in the order they're listed so any actions that need to be done before real tests are run can simply be put before the tests.

Example Config

An example config file can be found here but also below:

{
  "Services": {
    "test": {
      "Script": "./example.sh",
      "Secret": "THISISVERYSECRET",
      "SignatureHeader": "X-Gitea-Signature",
      "Tests": [
        {
          "Command": "git",
          "Arguments": [ "pull" ]
        }
      ]
    }
  }
}