I have the following architecture:
An Azure cloud with Azure Devops completely written in Bicep and Azure-pipelines.yml
An Edge System that runs a Docker image
I am trying to find a way to pull a Docker image from the Azure Container Registry to my local edge system upon change. I was thinking this could maybe be done with a webhook or so.
For the whole workflow, I push code to my Azure repo, it then builds that code into a Docker image and pushes it to my Azure Container Registry so it is stored there. My Azure cloud uses that image to run on the Azure cloud.
I now want to add a second pipeline that can build the code for my AI and also builds it and pushes it to the Azure Container Registry, so that my edge system can pull the docker image from there upon change.
So to visualize:
AI code modifications push to Azure Container Registry –> Edge System pulls new Docker image from Azure Container Registry
I have tried to find resources online but haven’t found any that are trying my specific problem.
2
Answers
Azure Container Registry has webhooks. But They are a push model. i.e. Your edge device/system will need to have a public web address (https) which will be receiving the event from ACR. You can then respond to that event.
https://learn.microsoft.com/en-us/azure/container-registry/container-registry-webhook
Per your requirement to trigger the second pipeline to pull image from ACR once there was a new image pushed, you may add container resource to your YAML pipeline and enable automatic trigger of this resource type.
To pull the image on you Edge System, you need to configure self-hosted agent service in this system and set this second pipeline to run on this agent. Here is a sample YAML pipeline for your reference.
Thus, as soon as the first pipeline pushes an image to ACR repository, the second pipeline will be triggered and run
docker pull
command on the agent in the Edge System.Kindly note that the service principal referenced by the ARM service connection needs to have Contributor or Owner permissions for ACR to use automatic pipeline trigger and pull image from ACR.