Setting Up Builder Webhooks

Page last updated:

This topic describes how to set up builder webhooks for Pivotal Build Service.

Overview

By default, Build Service polls its image registry to know when buildpacks have been updated for a builder image. This allows Build Service to rebuild your images when updated buildpacks are available.

You may want to use webhooks instead of relying on the default polling behavior. Using webhooks avoids the polling delay when a builder image has been updated with new buildpacks.

Supported Image Registries

You can set up builder webhooks for any of the image registries in this section.

Artifactory

To set up builder webhooks for an Artifactory repository:

Note: The Artifactory repository must be the same one you used when you ran Duffle during the Build Service installation.

  1. Follow the installation procedure in the Artifactory Webhook Plugin repository on GitHub.

  2. Configure the plugin to send docker.tagCreated events to the BUILD-SERVICE-API/v1/artifactory/webhook endpoint, as in this example configuration:

    {
      "webhooks": {
        "ci": {
          "url": "BUILD-SERVICE-API/v1/artifactory/webhook",
          "events": [
            "docker.tagCreated"
          ],
          "repositories": ["ARTIFACTORY-REPOSITORY"],
          "format": "default"
        },
      }
    }
    

    Where:

    • BUILD-SERVICE-API is the URL of your API.
    • ARTIFACTORY-REPOSITORY is your Artifactory repository.

Docker Registry Notifications

To set up notifications for a Docker registry:

Note: The Docker registry must be the same one you used when you ran duffle relocate during the Build Service installation.

  1. Follow the configuration procedure in Work with notifications in the Docker documentation.

  2. Add a notification endpoint to your registry configuration, as in the example below:

     notifications:
        endpoints:
          - name: build-service
            url: BUILD-SERVICE-API/v1/docker/notification
            timeout: 5s
            threshold: 5
            backoff: 10s
    

    Where BUILD-SERVICE-API is the URL of your API.

Docker Hub

To set up builder webhooks for Docker Hub:

  1. Follow the configuration procedure in Docker Hub Webhooks in the Docker documenation to add a webhook for the relocated builder image.

    • You can find this image by running:
    kubectl get builder build-service-builder -n build-service-builds -o jsonpath='{.spec.image}'
    

    Where BUILD-SERVICE-API is the URL of your API.

  • The webhook should be configured to use the BUILD-SERVICE-API/v1/docker/webhook endpoint.

    Warning: Docker Hub requires Build Service to use a CA-signed certificate.