Update webhooks doc

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
This commit is contained in:
Gabriel Adrian Samfira 2023-07-17 15:48:12 +00:00
parent 0ae1f7f5f2
commit 751da62b1e
6 changed files with 31 additions and 2 deletions

BIN
doc/images/input_url.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 KiB

BIN
doc/images/jobs.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 218 KiB

BIN
doc/images/tls_config.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 KiB

BIN
doc/images/webhooks.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

View file

@ -2,7 +2,13 @@
Garm is designed to auto-scale github runners. To achieve this, ```garm``` relies on [GitHub Webhooks](https://docs.github.com/en/developers/webhooks-and-events/webhooks/about-webhooks). Webhooks allow ```garm``` to react to workflow events from your repository, organization or enterprise.
In your repository or organization, navigate to ```Settings --> Webhooks```. In the ```Payload URL``` field, enter the URL to the ```garm``` webhook endpoint. The ```garm``` API endpoint for webhooks is:
In your repository or organization, navigate to ```Settings --> Webhooks```:
![webhooks](images/webhooks.png)
And click on ```Add webhook```.
In the ```Payload URL``` field, enter the URL to the ```garm``` webhook endpoint. The ```garm``` API endpoint for webhooks is:
```txt
POST /webhooks
@ -24,4 +30,27 @@ The webhook secret must be secure. Use something like this to generate one:
9Q<fVm5dtRhUIJ>*nsr*S54g0imK64(!2$Ns6C!~VsH(p)cFj+AMLug%LM!R%FOQ
```
Next, you can choose which events GitHub should send to ```garm``` via webhooks. Click on ```Let me select individual events``` and select ```Workflow jobs``` (should be at the bottom). You can send everything if you want, but any events ```garm``` doesn't care about will simply be ignored.
Make a note of that secret, as you'll need it later when you define the repo/org/enterprise in ```GARM```.
![webhook](images/input_url.png)
While you can use `http` for your webhook, I highly recommend you set up a proper x509 certificate for your GARM server and use `https` instead. If you choose `https`, GitHub will present you with an aditional option to configure the SSL certificate verification.
![ssl](images/tls_config.png)
If you're testing, you can disable SSL verification or just use `http`, but for production you should use `https` with a proper certificate and SSL verification set to `enabled`.
It's fairly trivial to set up a proper x509 certificate for your GARM server. You can use [Let's Encrypt](https://letsencrypt.org/) to get a free certificate.
Next, you can choose which events GitHub should send to ```garm``` via webhooks. Click on ```Let me select individual events```.
![events](images/select_events.png)
Now select ```Workflow jobs``` (should be at the bottom). You can send everything if you want, but any events ```garm``` doesn't care about will simply be ignored.
![workflow](images/jobs.png)
Finally, click on ```Add webhook``` and you're done.
GitHub will send a test webhook to your endpoint. If all is well, you should see a green checkmark next to your webhook.