From c44423e5ffccb8061a712f99f0a8f71c0087cb4e Mon Sep 17 00:00:00 2001 From: Maurits van Rees Date: Thu, 22 Jan 2026 14:04:01 +0100 Subject: [PATCH] Support empty username and password for docker login. In my testing, the check for an empty USERNAME by doing `-z "${USERNAME+x}"` always fails: it is never empty. The `+x` seems wrong to me. A trick like that can be needed when comparing two strings, but not when checking if a single string is empty. Let's test. First without the `USERNAME` variable existing at all: ``` $ env | grep USERNAME $ if [ -z "${USERNAME+x}" ] ; then echo "empty"; fi empty $ if [ -z "${USERNAME}" ] ; then echo "empty"; fi empty ``` Fine. Now with `USERNAME` variable defined, and not empty: ``` $ export USERNAME=me $ if [ -z "${USERNAME+x}" ] ; then echo "empty"; fi $ if [ -z "${USERNAME}" ] ; then echo "empty"; fi ``` Also fine. Now with `USERNAME` variable defined, but empty: ``` $ export USERNAME= $ if [ -z "${USERNAME+x}" ] ; then echo "empty"; fi $ if [ -z "${USERNAME}" ] ; then echo "empty"; fi empty ``` The check with `=x` is wrong here. --- scripts/docker-entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/docker-entrypoint.sh b/scripts/docker-entrypoint.sh index b0d53d5..aeb85f6 100755 --- a/scripts/docker-entrypoint.sh +++ b/scripts/docker-entrypoint.sh @@ -96,7 +96,7 @@ else fi # PROCEED WITH LOGIN -if [ -z "${USERNAME+x}" ] || [ -z "${PASSWORD+x}" ]; then +if [ -z "${USERNAME}" ] || [ -z "${PASSWORD}" ]; then echo "Container Registry: No authentication provided" else [ -z ${REGISTRY+x} ] && export REGISTRY=""