File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed
Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change 11#! /bin/sh
22
3- set -e
3+ set -xe
44
55# update the auth token
66CONFIG=/usr/local/openresty/nginx/conf/nginx.conf
77AUTH=$( grep X-Forwarded-User $CONFIG | awk ' {print $4}' | uniq| tr -d " \n\r" )
8- TOKEN=$( aws ecr get-login --no-include-email | awk ' {print $6}' )
8+
9+ # retry till new get new token
10+ while true ; do
11+ TOKEN=$( aws ecr get-login --no-include-email | awk ' {print $6}' )
12+ [ ! -z " ${TOKEN} " ] && break
13+ echo " Warn: Unable to get new token, wait and retry!"
14+ sleep 30
15+ done
16+
17+
918AUTH_N=$( echo AWS:${TOKEN} | base64 | tr -d " [:space:]" )
1019
1120sed -i " s|${AUTH% ??} |${AUTH_N} |g" $CONFIG
Original file line number Diff line number Diff line change 11# Refresh the AWS ECR token periodically.
22# min hour day month weekday command
3- 0 * * * * /renew_token.sh
3+ 0 */6 * * * /renew_token.sh
You can’t perform that action at this time.
0 commit comments