From: Michael Stapelberg Date: Sun, 6 Mar 2016 17:51:52 +0000 (+0100) Subject: travis: skip login+push for pull requests X-Git-Tag: 4.13~112 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=42f5a6ce479968a8f95dd5a827524865094d6a5c;p=i3%2Fi3 travis: skip login+push for pull requests --- 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