travis: skip login+push for pull requests

This commit is contained in:
Michael Stapelberg 2016-03-06 18:51:52 +01:00
parent ab2d46b65b
commit 42f5a6ce47
1 changed files with 8 additions and 2 deletions

View File

@ -7,5 +7,11 @@ set -e
echo .git > .dockerignore echo .git > .dockerignore
docker build --pull --no-cache --rm -t=${BASENAME} -f travis-build.Dockerfile . docker build --pull --no-cache --rm -t=${BASENAME} -f travis-build.Dockerfile .
# 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 isnt set.
if [ -n "${DOCKER_PASS}" ]
then
docker login -e ${DOCKER_EMAIL} -u ${DOCKER_USER} -p ${DOCKER_PASS} docker login -e ${DOCKER_EMAIL} -u ${DOCKER_USER} -p ${DOCKER_PASS}
docker push ${BASENAME} docker push ${BASENAME}
fi