Skip to content

Commit 0888419

Browse files
authored
QIL improvement to common.sh: check for null return status from ECR call (#428)
* QIL improvement to common.sh: check for null return status from ECR call * Simplify
1 parent 5404da8 commit 0888419

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

scripts/lib/common.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,12 @@ is_public_ecr_logged_in() {
149149
# Base64 decode it
150150
# Read the "expiration" value
151151
local expiration_time
152-
expiration_time=$(jq -r --arg url $public_ecr_url '.auths[$url].auth' ~/.docker/config.json | base64 -d | cut -d":" -f2 | base64 -d | jq -r ".expiration")
152+
auth_string=$(jq -r --arg url $public_ecr_url '.auths[$url].auth' ~/.docker/config.json)
153+
154+
[ -z "$auth_string" ] && return 1
155+
[ "$auth_string" = "null" ] && return 1
156+
157+
expiration_time=$(echo $auth_string | base64 -d | cut -d":" -f2 | base64 -d | jq -r ".expiration")
153158

154159
# If any part of this doesn't exist, the user isn't logged in
155160
[ -z "$expiration_time" ] && return 1

0 commit comments

Comments
 (0)