From 03c888c565bd033c8b9a189378752ca284d6597e Mon Sep 17 00:00:00 2001 From: Tom <22802157+tomdess@users.noreply.github.com> Date: Thu, 1 May 2025 11:57:12 +0200 Subject: [PATCH 1/2] add ACR webhook to Hook-Examples.md Incoming Azure Container Registry (ACR) webhook syntax and format with link to a working docker container used to handle webhook and feed a local registry cache --- docs/Hook-Examples.md | 70 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/docs/Hook-Examples.md b/docs/Hook-Examples.md index 1b01ea4..eaf2cea 100644 --- a/docs/Hook-Examples.md +++ b/docs/Hook-Examples.md @@ -22,6 +22,7 @@ although the examples on this page all use the JSON format. * [Multipart Form Data](#multipart-form-data) * [Pass string arguments to command](#pass-string-arguments-to-command) * [Receive Synology DSM notifications](#receive-synology-notifications) +* [Incoming Azure Container Registry (ACR) webhook](#incoming-acr-webhook) ## Incoming Github webhook @@ -673,3 +674,72 @@ Webhooks feature introduced in DSM 7.x seems to be incomplete & broken, but you } ] ``` +## Incoming Azure Container Registry (ACR) webhook + +On ACR you can configure webhooks for images push events, below the hooks.json format to handle those events. + +Here is an example of a working docker webhook container used to handle the hooks and fill the cache of a local registry [ACR Harbor local cache feeder](https://github.com/tomdess/registry-cache-feeder). + + +```json +[ + { + "id": "acr-push-event", + "execute-command": "/config/script-acr.sh", + "command-working-directory": "/config", + "pass-environment-to-command": + [ + { + "envname": "ACTION", + "source": "payload", + "name": "action" + }, + { + "envname": "REPO", + "source": "payload", + "name": "target.repository" + }, + { + "envname": "TAG", + "source": "payload", + "name": "target.tag" + }, + { + "envname": "DIGEST", + "source": "payload", + "name": "target.digest" + } + ], + "trigger-rule": + { + "and": + [ + { + "match": + { + "type": "value", + "value": "mysecretToken", + "parameter": + { + "source": "header", + "name": "X-Static-Token" + } + } + }, + { + "match": + { + "type": "value", + "value": "push", + "parameter": + { + "source": "payload", + "name": "action" + } + } + } + ] + } + } +] +``` From 5d0285372cdc25468ed717ffbe65aebaec0c40df Mon Sep 17 00:00:00 2001 From: Tom <22802157+tomdess@users.noreply.github.com> Date: Thu, 1 May 2025 19:29:29 +0200 Subject: [PATCH 2/2] Update Hook-Examples.md changed text according to suggestions of https://github.com/moorereason (see PR) --- docs/Hook-Examples.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/Hook-Examples.md b/docs/Hook-Examples.md index eaf2cea..08de456 100644 --- a/docs/Hook-Examples.md +++ b/docs/Hook-Examples.md @@ -676,9 +676,9 @@ Webhooks feature introduced in DSM 7.x seems to be incomplete & broken, but you ``` ## Incoming Azure Container Registry (ACR) webhook -On ACR you can configure webhooks for images push events, below the hooks.json format to handle those events. +ACR can send webhooks on image push events. The `hooks.json` below will handle those events and pass relevant properties as environment variables to a command. -Here is an example of a working docker webhook container used to handle the hooks and fill the cache of a local registry [ACR Harbor local cache feeder](https://github.com/tomdess/registry-cache-feeder). +Here is an example of a working docker webhook container used to handle the webhooks and fill the cache of a local registry: [ACR Harbor local cache feeder](https://github.com/tomdess/registry-cache-feeder). ```json