Commit a6e6e1f5 authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Corrige de nuevo deploy con auth requerida

El orden de los parámetros no fue suficiente para corregirlo. Una manera
de evitar este bug, es aplicar el parámetro "--with-registry-auth" a
través del comando "docker service update", en el que si funciona
correctamente.
parent 82d90e4d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -65,6 +65,7 @@ You may define these environment variables (**bold** are mandatory):
* *REGISTRY_PASS*: Docker registry password, corresponding to a user with read permissions. **Required** for private registry or repository.
* *REGISTRY_URL*: Docker registry address, where Docker must log in to retrieve images. Useful only when using private registry or repository. Default is empty, to use Docker Hub registry.
* *REGISTRY_USER*: Docker registry username, corresponding to a user with read permissions. **Required** for private registry or repository.
* *SERVICES_TO_AUTH*: Names of services which need authorization to access to private registry, separated by space. Default is empty, to use service names found into docker-compose files with stack prefix (`<stack-name>_<service-name>`).
* *SERVICE*: Name of service to relaunch (`<stack-name>_<service-name>`). Available and **required** only for *relaunch* action.
* *SERVICES_TO_CHECK*: Names of services to check after deployment, separated by space. Default is `STACK` variable value, but setting this to a valid service name is recommended (`<stack-name>_<service-name>`).
* *SERVICES_TO_DEPLOY*: Names of services to deploy, separated by space. Available only for standard (*docker-compose*) mode. Default is empty, to deploy all defined services.
+15 −4
Original line number Diff line number Diff line
@@ -11,15 +11,26 @@ deployCmd="\
	else \
		deployAuthParam=\"\" ; \
	fi ; \
	standardComposeFileSplitted=\$(echo ${COMPOSE_FILE} | sed 's/:/ -f /g') ; \
	if [ ${FORCE_DOCKER_COMPOSE} -eq 0 ] && docker stack ls > /dev/null 2> /dev/null ; \
	then \
		composeFileSplitted=\$(echo ${COMPOSE_FILE} | sed 's/:/ -c /g') && \
		swarmComposeFileSplitted=\$(echo ${COMPOSE_FILE} | sed 's/:/ -c /g') && \
		${GREP_BIN} -v '^[#| ]' .env | sed -r \"s/(\w+)=(.*)/export \1='\2'/g\" > .env-deploy && \
		env -i /bin/sh -c \". \$(pwd)/.env-deploy && \
			docker stack deploy \${deployAuthParam} -c \${composeFileSplitted} ${STACK}\" ; \
			docker stack deploy \${deployAuthParam} -c \${swarmComposeFileSplitted} ${STACK}\" ; \
		if [ -z \"${SERVICES_TO_AUTH}\" ] ; \
		then \
			SERVICES_TO_AUTH=\"\$(docker-compose --log-level ERROR -f \${standardComposeFileSplitted} config --services)\" ; \
		fi ; \
		if [ ! -z \"\${deployAuthParam}\" -a ! -z \"${SERVICES_TO_AUTH}\" ] ; \
		then \
			for serviceToAuth in ${SERVICES_TO_AUTH} \
			do \
				docker service update \${deployAuthParam} ${STACK}_\${serviceToAuth} ; \
			done ; \
		fi ; \
	else \
		composeFileSplitted=\$(echo ${COMPOSE_FILE} | sed 's/:/ -f /g') && \
		composeCmd=\"docker-compose -f \${composeFileSplitted} -p ${STACK}\" && \
		composeCmd=\"docker-compose -f \${standardComposeFileSplitted} -p ${STACK}\" && \
		\${composeCmd} stop ${SERVICES_TO_DEPLOY} && \
		\${composeCmd} rm -f ${SERVICES_TO_DEPLOY} && \
		\${composeCmd} pull ${SERVICES_TO_DEPLOY} && \