From 42f5a6ce479968a8f95dd5a827524865094d6a5c Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Sun, 6 Mar 2016 18:51:52 +0100 Subject: [PATCH] travis: skip login+push for pull requests --- travis/docker-build-and-push.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/travis/docker-build-and-push.sh b/travis/docker-build-and-push.sh index 7dfd3392..76e2a132 100755 --- a/travis/docker-build-and-push.sh +++ b/travis/docker-build-and-push.sh @@ -7,5 +7,11 @@ set -e echo .git > .dockerignore docker build --pull --no-cache --rm -t=${BASENAME} -f travis-build.Dockerfile . -docker login -e ${DOCKER_EMAIL} -u ${DOCKER_USER} -p ${DOCKER_PASS} -docker push ${BASENAME} +# For pull requests, travis does not add secure environment variables to the +# environment (because pull requests could then steal their values), so skip +# the login+push step when the variable isn’t set. +if [ -n "${DOCKER_PASS}" ] +then + docker login -e ${DOCKER_EMAIL} -u ${DOCKER_USER} -p ${DOCKER_PASS} + docker push ${BASENAME} +fi -- 2.39.5