File tree 2 files changed +12
-3
lines changed
2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change 1
1
#! /bin/sh
2
2
3
- set -e
3
+ set -xe
4
4
5
5
# update the auth token
6
6
CONFIG=/usr/local/openresty/nginx/conf/nginx.conf
7
7
AUTH=$( 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
+
9
18
AUTH_N=$( echo AWS:${TOKEN} | base64 | tr -d " [:space:]" )
10
19
11
20
sed -i " s|${AUTH% ??} |${AUTH_N} |g" $CONFIG
Original file line number Diff line number Diff line change 1
1
# Refresh the AWS ECR token periodically.
2
2
# 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