Skip to content

Instantly share code, notes, and snippets.

@antdking
Last active October 6, 2022 08:41
Show Gist options
  • Save antdking/46d33b3e09cac3cc34bbbe3ce3eb33f4 to your computer and use it in GitHub Desktop.
Save antdking/46d33b3e09cac3cc34bbbe3ce3eb33f4 to your computer and use it in GitHub Desktop.
Setup pkg.dev authentication
#!/usr/bin/env bash
# gcloud doesn't provide a mechanism to configure Artifact Registry auth helpers out the box.
# ref: https://cloud.google.com/artifact-registry/docs/docker/authentication?hl=en-GB#gcloud-helper
registries="$(gcloud artifacts locations list --format json | jq -r '. | map("\(.name)-docker.pkg.dev") | join(",") | @sh')"
# don't quote 'registries', it's already escaped by jq
gcloud auth configure-docker $registries
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment