From c5e52b99cff0c7c7ec91428700048f01d8a7d6c9 Mon Sep 17 00:00:00 2001 From: Nikita Fedkin Date: Tue, 1 Oct 2024 07:33:43 +0200 Subject: [PATCH] No login if no credentials provided --- build-base-swarm-jenkins-agent.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build-base-swarm-jenkins-agent.sh b/build-base-swarm-jenkins-agent.sh index 1dd9e13..6a7c14d 100755 --- a/build-base-swarm-jenkins-agent.sh +++ b/build-base-swarm-jenkins-agent.sh @@ -1,7 +1,9 @@ #!/bin/bash set -e -docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD $DOCKER_REGISTRY_URL +if [ $DOCKER_LOGIN != '' ] ; then + docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD $DOCKER_REGISTRY_URL +fi if [ $DOCKER_SYSTEM_PRUNE = 'true' ] ; then docker system prune -af