From 2f884820ea7e93cea0e649340b08214e58f73d60 Mon Sep 17 00:00:00 2001 From: Francesc Arbona Date: Tue, 4 Jul 2023 17:08:19 +0200 Subject: [PATCH] feat: Allow ACR authentication using Azure CLI Install azure-cli in Docker image in order to use the `az acr login` command. Can be used with Azure Managed Identities with the following script: ```yaml --- apiVersion: v1 kind: ConfigMap metadata: name: argocd-image-updater-config namespace: argocd data: log.level: debug registries.conf: | registries: - name: acrexample api_url: https://acrexample.azurecr.io/ prefix: acrexample.azurecr.io ping: yes insecure: no credentials: ext:/app/scripts/acr-login.sh credsexpire: 10h --- apiVersion: v1 kind: ConfigMap metadata: name: argocd-image-updater-config-acr namespace: argocd data: acr-login.sh: | #!/bin/sh LOGIN=$(az login --identity) REGISTRY="acrexample" TOKEN=$(az acr login --name $REGISTRY --expose-token --output tsv --query accessToken) echo "00000000-0000-0000-0000-000000000000:$TOKEN" ``` Closes #550 and #473 --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index ec38e462..d7adf96a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,6 +17,8 @@ RUN apk update && \ apk add ca-certificates git openssh-client python3 py3-pip && \ pip3 install --upgrade pip && \ pip3 install awscli && \ + apk add gcc musl-dev python3-dev libffi-dev openssl-dev cargo make && \ + pip3 install azure-cli && \ rm -rf /var/cache/apk/* RUN mkdir -p /usr/local/bin