Skip to content

Commit 4afdffc

Browse files
committed
fix: replace deprecated aws ecr get-login with get-authorization-token
1 parent 063405d commit 4afdffc

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

files/renew_token.sh

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,13 @@ AUTH=$(grep X-Forwarded-User $CONFIG | awk '{print $4}'| uniq|tr -d "\n\r")
99
set +x
1010
# retry till new get new token
1111
while true; do
12-
TOKEN=$(aws ecr get-login --no-include-email | awk '{print $6}')
12+
TOKEN=$(aws ecr get-authorization-token --query 'authorizationData[*].authorizationToken' --output text)
1313
[ ! -z "${TOKEN}" ] && break
1414
echo "Warn: Unable to get new token, wait and retry!"
1515
sleep 30
1616
done
1717

18-
19-
AUTH_N=$(echo AWS:${TOKEN} | base64 |tr -d "[:space:]")
20-
21-
echo $AUTH_N > /usr/local/openresty/nginx/token.txt
18+
echo $TOKEN > /usr/local/openresty/nginx/token.txt
2219
set -x
2320

2421
nginx -s reload

files/startup.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ chmod 600 -R ${AWS_FOLDER}
8080
set +x
8181
# add the auth token in default.conf
8282
AUTH=$(grep X-Forwarded-User $CONFIG | awk '{print $4}'| uniq|tr -d "\n\r")
83-
TOKEN=$(aws ecr get-login --no-include-email | awk '{print $6}')
84-
AUTH_N=$(echo AWS:${TOKEN} | base64 |tr -d "[:space:]")
85-
echo $AUTH_N > /usr/local/openresty/nginx/token.txt
83+
TOKEN=$(aws ecr get-authorization-token --query 'authorizationData[*].authorizationToken' --output text)
84+
85+
echo $TOKEN > /usr/local/openresty/nginx/token.txt
8686

8787
set -x
8888
# make sure cache directory has correct ownership

0 commit comments

Comments
 (0)