Azure Container Registry

To give FeaturePeek the credentials to pull images from Azure Container Registry, you need to ensure that a few environment variables are present in your CI environment.

You can use any CI provider to push to ACR, although it's most likely that you're using Azure Pipelines. To learn more about defining variables for Azure Pipelines, read how to set variables in your pipeline.

Note: This chapter is only applicable if you push images to Azure Container Registry.

CI command

You'll need to pass in the -p flag when pinging FeaturePeek in your CI pipeline.

bash <(curl -s https://peek.run/ci) -p myregistryid.azurecr.io/myimagerepo:$(tag)

Be sure to call this after your build step.

Required environment variables

There are three environment variables that are required to be set:

  • ACR_REGISTRY_ID must always be set.
  • If you authenticate to ACR via username/password, ACR_USER_NAME and ACR_PASSWORD must be set.
  • If you authenticate to ACR via service principal, ACR_SP_ID and ACR_SP_PASSWD must be set.

ACR_REGISTRY_ID

Your registry identifier that appears as the subdomain of azurecr.io.

ACR_USER_NAME

Your ACR username. If this environment variable is present, ACR_PASSWORD must also be present.

ACR_PASSWORD

Your ACR password. If this environment variable is present, ACR_USER_NAME must also be present.

ACR_SP_ID

The UUID of your service principal. If this environment variable is present, ACR_SP_PASSWD must also be present.

ACR_SP_PASSWD

Your service principal password. If this environment variable is present, ACR_SP_ID must also be present.

Example pipeline file

While you can use any Continuous Integration provider to push to Azure Container Registry, here's an example configuration file using Azure Pipelines.

# /azure-pipelines.yml
# Build and push an image to Azure Container Registry
# https://docs.microsoft.com/azure/devops/pipelines/languages/docker
trigger:
- master
resources:
- repo: self
variables:
dockerRegistryServiceConnection: "*YOUR-UUID-GOES-HERE*"
imageRepository: "myimagerepo"
containerRegistry: "myregistryid.azurecr.io"
dockerfilePath: "$(Build.SourcesDirectory)/Dockerfile"
tag: "$(Build.BuildId)"
stages:
- stage: Build
jobs:
- job: Build
displayName: Build
pool:
vmImage: "ubuntu-latest"
steps:
displayName: Build and push an image to container registry
inputs:
command: buildAndPush
repository: $(imageRepository)
dockerfile: $(dockerfilePath)
containerRegistry: $(dockerRegistryServiceConnection)
tags: |
$(tag)
- script: bash <(curl -s https://peek.run/ci) -p $(containerRegistry)/$(imageRepository):$(tag)
displayName: "Ping FeaturePeek"