From 7e61ab4a0fd7f96f388944e2a4aa6d04afa49db5 Mon Sep 17 00:00:00 2001 From: Matthias Volk Date: Tue, 20 Nov 2018 17:31:58 +0100 Subject: [PATCH] Travis: Disable deployment if no credentials are given --- travis/deploy_carl.sh | 44 +++++++++++++++++++++++++----------------- travis/deploy_storm.sh | 44 +++++++++++++++++++++++++----------------- 2 files changed, 52 insertions(+), 36 deletions(-) diff --git a/travis/deploy_carl.sh b/travis/deploy_carl.sh index f66974c00..787e7fcec 100755 --- a/travis/deploy_carl.sh +++ b/travis/deploy_carl.sh @@ -4,26 +4,34 @@ set -e OS=$TRAVIS_OS_NAME +# Do not deploy if credentials are not given +if [ "${TRAVIS_SECURE_ENV_VARS}" == "false" ]; then + echo "WARNING: Not deploying as no credentials are given." + exit 0; +fi + +# Do not deploy for pull requests +if [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then + exit 0; +fi + case $OS in linux) - # Only deploy for non pull requests - if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin - # Deploy as debug/release - case "$CONFIG" in - *DebugTravis) - docker commit carl movesrwth/carl:travis-debug - docker push movesrwth/carl:travis-debug - ;; - *ReleaseTravis) - docker commit carl movesrwth/carl:travis - docker push movesrwth/carl:travis - ;; - *) - echo "Unrecognized value of CONFIG: $CONFIG"; exit 1 - ;; - esac - fi + echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin + # Deploy as debug/release + case "$CONFIG" in + *DebugTravis) + docker commit carl movesrwth/carl:travis-debug + docker push movesrwth/carl:travis-debug + ;; + *ReleaseTravis) + docker commit carl movesrwth/carl:travis + docker push movesrwth/carl:travis + ;; + *) + echo "Unrecognized value of CONFIG: $CONFIG"; exit 1 + ;; + esac ;; osx) diff --git a/travis/deploy_storm.sh b/travis/deploy_storm.sh index f026eaae6..e1c41a3cd 100755 --- a/travis/deploy_storm.sh +++ b/travis/deploy_storm.sh @@ -4,26 +4,34 @@ set -e OS=$TRAVIS_OS_NAME +# Do not deploy if credentials are not given +if [ "${TRAVIS_SECURE_ENV_VARS}" == "false" ]; then + echo "WARNING: Not deploying as no credentials are given." + exit 0; +fi + +# Do not deploy for pull requests +if [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then + exit 0; +fi + case $OS in linux) - # Only deploy for non pull requests - if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin - # Deploy as debug/release - case "$CONFIG" in - *DebugTravis) - docker commit storm movesrwth/storm:travis-debug - docker push movesrwth/storm:travis-debug - ;; - *ReleaseTravis) - docker commit storm movesrwth/storm:travis - docker push movesrwth/storm:travis - ;; - *) - echo "Unrecognized value of CONFIG: $CONFIG"; exit 1 - ;; - esac - fi + echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin + # Deploy as debug/release + case "$CONFIG" in + *DebugTravis) + docker commit storm movesrwth/storm:travis-debug + docker push movesrwth/storm:travis-debug + ;; + *ReleaseTravis) + docker commit storm movesrwth/storm:travis + docker push movesrwth/storm:travis + ;; + *) + echo "Unrecognized value of CONFIG: $CONFIG"; exit 1 + ;; + esac ;; osx)