Skip to main content

Container Registry Webhook

Getting Started

Pulumi doesn't support fetching a SCM URI of the WebApp in the same run of script as the WebApp creation. Therefore, it's required to create a Resource Provider that would help to avoid that issue. This Resource Provider is fetching the SCM URI for the indicated WebApp and manipulating the Webhook according to changes in the script.

AZ Reference

MethodLink
Createhttps://learn.microsoft.com/en-us/cli/azure/acr/webhook?view=azure-cli-latest#az-acr-webhook-create
Readhttps://learn.microsoft.com/en-us/cli/azure/acr/webhook?view=azure-cli-latest#az-acr-webhook-show
Updatehttps://learn.microsoft.com/en-us/cli/azure/acr/webhook?view=azure-cli-latest#az-acr-webhook-update
Deletehttps://learn.microsoft.com/en-us/cli/azure/acr/webhook?view=azure-cli-latest#az-acr-webhook-delete

Used in the methods Create and Update to fetch SCM URI: https://learn.microsoft.com/en-us/cli/azure/webapp/deployment?view=azure-cli-latest#az-webapp-deployment-list-publishing-credentials

Usage

const appSignalingHTTPSocketIOAcrWebhook = pulumi
.all([appSignalingHTTPSocketIO])
.apply(([appSignalingHTTPSocketIO]) => {
return new AcrWebhook(`acr-wh-${appSignalingHTTPSocketIOName}`.replace(/-/g, ''), {
webAppName: pulumi.interpolate`${appSignalingHTTPSocketIO.name}`,
resourceGroupName: rgName,
registryName: acrName,
subscription: rgSubId,
actions: [WebhookAction.push]
});
});

Discussion

Creating a Webhook in the same script run as creation of WebApp is not possible due to Pulumi function listWebAppPublishingCredentials. It's trying to fetch information about WebApp that is not existing yet, it's an issue due to core behavior of Pulumi. There's an issue created and once is solved, the Custom Resource Provider won't be necessary.

(GitHub) Output functions fail in preview section of an update if not all the inputs are available