Skip to main content

Azure Webhook Receiver

The Azure webhook receiver responds to push and ping events originating from Azure Container Registry repositories and git.push events originating from Azure DevOps repositories.

The receiver unconditionally responds to ping events with an HTTP 200 status code.

The receiver responds to push and git.push events by refreshing all Warehouse resources subscribed to the repositories that correspond to the event.

info

"Refreshing" a Warehouse resource means enqueuing it for immediate reconciliation by the Kargo controller, which will execute the discovery of new artifacts from all repositories to which that Warehouse subscribes.

Configuring the Receiver

An Azure webhook receiver must reference a Kubernetes Secret resource with a secret key in its data map.

info

This secret will not be shared directly with Azure.

Azure does not natively implement any mechanism whereby receivers may authenticate inbound webhook requests. To compensate for this, Kargo incorporates the secret into the generation of a hard-to-guess URL for the receiver. This URL serves as a de facto shared secret and authentication mechanism.

note

The following commands are suggested for generating and base64-encoding a complex secret:

secret=$(openssl rand -base64 48 | tr -d '=+/' | head -c 32)
echo "Secret: $secret"
echo "Encoded secret: $(echo -n $secret | base64)"
apiVersion: v1
kind: Secret
metadata:
name: azure-wh-secret
namespace: kargo-demo
labels:
kargo.akuity.io/cred-type: generic
data:
secret: <base64-encoded secret>
---
apiVersion: kargo.akuity.io/v1alpha1
kind: ProjectConfig
metadata:
name: kargo-demo
namespace: kargo-demo
spec:
webhookReceivers:
- name: azure-wh-receiver
azure:
secretRef:
name: azure-wh-secret

Retrieving the Receiver's URL

Kargo will generate a hard-to-guess URL from the receiver's configuration. This URL can be obtained using a command such as the following:

kubectl get projectconfigs kargo-demo \
-n kargo-demo \
-o=jsonpath='{.status.webhookReceivers}'

Registering with Azure

The Azure webhook receiver supports both Azure Container Registry and Azure DevOps services.

Azure Container Registry

  1. In your Azure Container Registry portal, on the left-hand side, navigate to ServicesWebhooks.

  2. At the top of the screen, click Add.

    Webhooks

  3. Complete the Create webhook form:

    Create Webhook

    1. Enter a descriptive name in the Webhook name field.

    2. Select the Location closest to where your Kargo instance is running.

    3. Complete the Service URI field using the URL for the webhook receiver.

    4. From the Actions drop-down menu, select push.

    5. Ensure Active is checked.

    6. Set the Scope using the format <repository>:<tag>.

      note

      Wildcards are supported in both the repository and tag part of the Scope string.

    7. Click Create.

    8. Return to the Webhooks dashboard and select the newly created webhook.

      Created

    9. Click Ping.

    10. Click Refresh.

      Ping

    11. Confirm a 200 Http Status for the Ping action.

      Success

info

For additional information on configuring ACR webhooks, refer directly to the ACR Docs.

Azure DevOps

  1. Navigate to https://dev.azure.com/<org>/<project>/_settings/serviceHooks, where<org> has been replaced with an organization name and <project> has been replaced with the name of a project belonging to that account and for which you are an administrator.

  2. On the left-hand-side menu under General, click Service Hooks.

  3. Click Create Subscription.

    Create Sub

  4. In the New Service Hooks Subscription modal, scroll down to Webhooks on the left-hand-side.

  5. Click Webhooks.

  6. Click Next.

New Service Hook

  1. Complete the Trigger form:

    Trigger

    1. Select Code Pushed from the drop-down menu labeled Trigger on this type of event.

    2. Select the Repositories, Branches, and Users for which the event will trigger for.

    3. Click Next.

  2. Complete the Action form:

    Action

    1. Complete the Service URI field using the URL for the webhook receiver.

    2. Click Test.

      Success

  3. After receiving a Succeeded notification, click Close.

  4. Click Finish.

info

For additional information on configuring Azure DevOps webhooks, refer directly to the Azure DevOps Docs.