Skip to content

Commit e5b7e5d

Browse files
committed
operator: safer IMAGE_TAG/REPO
1 parent a77b4c1 commit e5b7e5d

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

hack/deploy_vars

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,13 @@ else
2020
fi
2121

2222
# Extract image repository and tag from IMG variable
23-
IMAGE_REPO=$(echo "${IMG}" | cut -d: -f1)
24-
IMAGE_TAG=$(echo "${IMG}" | cut -d: -f2)
25-
23+
if [[ "${IMG}" == *:* ]]; then
24+
IMAGE_TAG="${IMG##*:}" # everything after the last colon
25+
IMAGE_REPO="${IMG%:*}" # everything before the last colon
26+
else # no tag specified
27+
IMAGE_TAG="latest"
28+
IMAGE_REPO="${IMG}"
29+
fi
2630
# Export all variables for use in scripts
2731
export IP
2832
export BASEDOMAIN

0 commit comments

Comments
 (0)