Documentation

Webhooks

You can add webhooks to both GitHub, GitLab and Bitbucket in order to trigger bundle builds and deployments whenever you push a new commit to a nominated branch.

Builds triggered by a webhook will use the same base software and directory map as your most recent, manual bundle build.

1. Creating the Webhook in Servd #

  1. In the webhooks section, enter the branch that you would like to track with your automated builds.

  2. Select whether you want the webhook to fire when the updated branch:

    • Matches the branch registered with the webhook exactly.
    • Starts with the branch registered with the webhook.
    • Ends with the branch registered with the webhook.
    • Or is found somewhere in the branch registered with the webhook.
  3. Optionally select an environment that you'd like to automatically deploy new bundles to.

  4. Make a note of the webhook URL and secret. You'll need them in a moment.

  5. Depending on who you store your repo with, carry on to the GitHub, GitLab or Bitbucket instructions below. 👇

2. Setting up the Webook with your Git Respository #

Next, you need to configure your git repository provider to send updates to Servd. Here are some instructions for doing that if you use GitHub, GitLab or Bitbucket.

GitHub #

  1. Open a browser tab and navigate to your Git repo on GitHub. Find the 'Settings' section and select 'Webhooks'.

  2. Click 'Add Webhook'

  3. Enter the webhook URL and secret from the Servd dashboard into the appropriate fields.

    1. Set the 'Content Type' to 'application/json'.
    2. Select 'Just the push event'
    3. Ensure 'Active' is checked.
  4. Click 'Add Webhook' and you're done! The next commit added to your nominated branch will trigger a bundle to be built in Servd.

Debugging Github Webhooks

If your webhook isn't working as expected, the best place to debug is on the 'Recent Deliveries' tab within the Github Webhook Settings.

This page will show you all of the recent attempts that GitHub has made to trigger the webhook, along with the response from Servd. Checking this response for errors will usually reveal the problem.

GitLab
#

  1. Open a browser tab and navigate to your Git repo on GitLab. Find the 'Settings' section and select 'Integrations'.

  2. Enter the webhook URL and secret obtained from the Servd dashboard.

    Check only 'Push Events' (everything else will be ignored anyway)

  3. Click 'Add Webhook' and you're done! The next commit added to your nominated branch will trigger a bundle to be built in Servd.

Bitbucket #

  1. Open a browser tab and navigate to your Git repo on Bitbucket. Find the 'Repository Settings' section and select 'Webhooks'. Click 'Add Webhook'.

  2. Give the webhook a name and paste the webhook URL obtained from the Servd dashboard.

    Check that 'Triggers' is set to 'Repository Push'

  3. Click 'Save' and you're done! The next commit added to your nominated branch will trigger a bundle to be built in Servd.