File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -15,20 +15,25 @@ if [ -z "${AWS_CLI_STR_ROLE_SESSION_NAME}" ]; then
1515fi
1616
1717if [ -z " ${CIRCLE_OIDC_TOKEN_V2} " ] || [ -z " ${CIRCLE_OIDC_TOKEN} " ]; then
18+ TOKEN_SETUP_SUCCESS=false
1819 for i in {1..3}; do
19- echo " Attempt $i : Checking OIDC tokens"
20+ echo " Attempt $i : Minting OIDC tokens"
2021 CIRCLE_OIDC_TOKEN=$( circleci run oidc get --claims " {\" aud\" :\" ${CIRCLE_ORGANIZATION_ID} \" }" )
21- if [ -n " $CIRCLE_OIDC_TOKEN " ] || [ -n " $CIRCLE_OIDC_TOKEN_V2 " ] ; then
22+ if [ -n " $CIRCLE_OIDC_TOKEN " ]; then
2223 echo " Successfully set CIRCLE_OIDC_TOKEN"
2324 echo ' export CIRCLE_OIDC_TOKEN="' " $CIRCLE_OIDC_TOKEN " ' "' >> " $BASH_ENV "
2425 echo ' export CIRCLE_OIDC_TOKEN_V2="' " $CIRCLE_OIDC_TOKEN " ' "' >> " $BASH_ENV "
25- exit 0
26+ TOKEN_SETUP_SUCCESS=true
27+ break
2628 fi
2729 echo " Waiting 1 second before retry"
2830 sleep 1
2931 done
30- echo " Failed to set CIRCLE_OIDC_TOKEN_V2 after 3 attempts"
31- exit 1
32+
33+ if [ " $TOKEN_SETUP_SUCCESS " = false ]; then
34+ echo " Failed to set CIRCLE_OIDC_TOKEN and CIRCLE_OIDC_TOKEN_V2 after 3 attempts. Please try rerunning the worklow."
35+ exit 1
36+ fi
3237fi
3338
3439if [ ! " $( command -v aws) " ]; then
You can’t perform that action at this time.
0 commit comments