Skip to content

Commit 486372b

Browse files
authored
Fix unbound variable in bash script (#124)
# Summary Fix unbound variable in bash script ## Proof of Work Script works when env var is not set
1 parent 2404e92 commit 486372b

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

scripts/dev/configure_docker_auth.sh

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,15 @@ fi
8181

8282
aws ecr get-login-password --region "eu-west-1" | docker login --username AWS --password-stdin 268558157000.dkr.ecr.eu-west-1.amazonaws.com
8383

84-
# log in to quay.io for the mongodb/mongodb-search-community private repo
85-
# TODO remove once we switch to the official repo in Public Preview
86-
quay_io_auth_file=$(mktemp)
87-
docker_configjson_tmp=$(mktemp)
88-
echo "${COMMUNITY_PRIVATE_PREVIEW_PULLSECRET_DOCKERCONFIGJSON}" | base64 -d > "${quay_io_auth_file}"
89-
jq -s '.[0] * .[1]' "${quay_io_auth_file}" ~/.docker/config.json > "${docker_configjson_tmp}"
90-
mv "${docker_configjson_tmp}" ~/.docker/config.json
91-
rm "${quay_io_auth_file}"
84+
if [[ -n "${COMMUNITY_PRIVATE_PREVIEW_PULLSECRET_DOCKERCONFIGJSON:-}" ]]; then
85+
# log in to quay.io for the mongodb/mongodb-search-community private repo
86+
# TODO remove once we switch to the official repo in Public Preview
87+
quay_io_auth_file=$(mktemp)
88+
docker_configjson_tmp=$(mktemp)
89+
echo "${COMMUNITY_PRIVATE_PREVIEW_PULLSECRET_DOCKERCONFIGJSON}" | base64 -d > "${quay_io_auth_file}"
90+
jq -s '.[0] * .[1]' "${quay_io_auth_file}" ~/.docker/config.json > "${docker_configjson_tmp}"
91+
mv "${docker_configjson_tmp}" ~/.docker/config.json
92+
rm "${quay_io_auth_file}"
93+
fi
9294

9395
create_image_registries_secret

0 commit comments

Comments
 (0)