Skip to content

Commit

Permalink
[ci] Accept multiple registries in the docker auth script (#12210)
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-goldstein authored Sep 21, 2022
1 parent 4818c93 commit e03edd4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion ci/buildkit/convert-cloud-credentials-to-docker-auth-config
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,11 @@ elif [ ! -z "${AZURE_APPLICATION_CREDENTIALS}" ]; then
fi

USER_PASS=$(echo -n "$USERNAME:$PASSWORD" | base64 | tr -d \\n)
echo '{"auths": { "'$REGISTRY'": { "auth": "'$USER_PASS'"}}}' > $HOME/.docker/config.json

registry_auths='{}'
for registry in ${REGISTRIES:=$REGISTRY}
do
registry_auths=$(echo $registry_auths | jq --arg registry "$registry" --arg userpass "$USER_PASS" '. + { ($registry): { "auth": $userpass }}')
done

echo '{"auths": '$registry_auths'}' > $HOME/.docker/config.json

0 comments on commit e03edd4

Please sign in to comment.