diff --git a/.travis.yml b/.travis.yml index d8178c3d5..c4feb532e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,15 +13,15 @@ env: - IMAGE_NAME=storageos/cluster-operator - IMAGE_TAG=test -before_install: - - | - if ! git diff --name-only $TRAVIS_COMMIT_RANGE | grep -qvE '(\.md)|(\.MD)|(\.png)|(\.pdf)|^(doc/)|^(MAINTAINERS)|^(LICENSE)'; then - # Do not skip if it's a tagged build. - if [[ -z "$TRAVIS_TAG" ]]; then - echo "Only doc files were updated, not running the CI." - exit - fi - fi +# before_install: +# - | +# if ! git diff --name-only $TRAVIS_COMMIT_RANGE | grep -qvE '(\.md)|(\.MD)|(\.png)|(\.pdf)|^(doc/)|^(MAINTAINERS)|^(LICENSE)'; then +# # Do not skip if it's a tagged build. +# if [[ -z "$TRAVIS_TAG" ]]; then +# echo "Only doc files were updated, not running the CI." +# exit +# fi +# fi # - docker run -d -p 2399:2399 quay.io/coreos/etcd:v3.3.10 /usr/local/bin/etcd -advertise-client-urls http://0.0.0.0:2399 -listen-client-urls http://0.0.0.0:2399 # Skip downloading deps. @@ -65,14 +65,12 @@ jobs: - make image/cluster-operator before_deploy: - docker login -u "$REGISTRY_USER" -p "$REGISTRY_PASS" - - docker tag "${IMAGE_NAME}:${IMAGE_TAG}" "${IMAGE_NAME}:latest" - - docker tag "${IMAGE_NAME}:${IMAGE_TAG}" "${IMAGE_NAME}:${TRAVIS_TAG}" deploy: - provider: script - script: docker push "${IMAGE_NAME}:latest" && docker push "${IMAGE_NAME}:${TRAVIS_TAG}" + script: bash scripts/deploy.sh tagged on: tags: true - provider: script - script: docker tag "${IMAGE_NAME}:${IMAGE_TAG}" "${IMAGE_NAME}:develop" && docker push "${IMAGE_NAME}:develop" + script: bash scripts/deploy.sh develop on: branch: master diff --git a/scripts/deploy.sh b/scripts/deploy.sh new file mode 100644 index 000000000..872edc3d1 --- /dev/null +++ b/scripts/deploy.sh @@ -0,0 +1,11 @@ +#!/bin/bash +set -e + +if [ "$1" = "tagged" ]; then + docker tag "${IMAGE_NAME}:${IMAGE_TAG}" "${IMAGE_NAME}:latest" + docker tag "${IMAGE_NAME}:${IMAGE_TAG}" "${IMAGE_NAME}:${TRAVIS_TAG}" + docker push "${IMAGE_NAME}:latest" && docker push "${IMAGE_NAME}:${TRAVIS_TAG}" +elif [ "$1" = "develop" ]; then + docker tag "${IMAGE_NAME}:${IMAGE_TAG}" "${IMAGE_NAME}:develop" + docker push "${IMAGE_NAME}:develop" +fi