File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77set -o errexit
88set -o nounset
99set -o pipefail
10- set -o xtrace
1110
1211# Validate required parameter
1312if [ $# -lt 1 ] || [ -z " ${1:- } " ]; then
3231 # Extract unique registry hostnames and then get locations
3332 REGISTRIES=$( grep -r -h -o -E ' [a-z0-9-]+-docker\.pkg\.dev/[^[:space:]"' \' ' ]*' " $DEVCONTAINER_PATH " 2> /dev/null | \
3433 cut -d' /' -f1 | \
35- sort -u)
34+ sort -u || true )
3635
3736 if [ -n " $REGISTRIES " ]; then
3837 echo " Found registries:" >&2
@@ -56,9 +55,6 @@ LOCATIONS=$(echo -e "${LOCATIONS}\n${DEFAULT_REGIONS_NEWLINE}" | sort -u)
5655# Get access token from metadata server
5756echo " Getting access token..." >&2
5857
59- # Temporarily disable xtrace to avoid logging sensitive credentials
60- set +o xtrace
61-
6258TOKEN=$( curl -s " http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token" -H " Metadata-Flavor: Google" )
6359ACCESS=$( echo ${TOKEN} | grep -oP ' (?<="access_token":")[^"]*' )
6460
@@ -70,7 +66,4 @@ echo "$LOCATIONS" | while read -r location; do
7066 echo " ${ACCESS} " | docker login -u oauth2accesstoken --password-stdin " https://${location} -docker.pkg.dev"
7167done
7268
73- # Re-enable xtrace
74- set -o xtrace
75-
7669echo " Done!" >&2
You can’t perform that action at this time.
0 commit comments