diff --git a/.travis.yml b/.travis.yml index d8178c3d5..911b0d9bc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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..c3e050dda --- /dev/null +++ b/scripts/deploy.sh @@ -0,0 +1,15 @@ +#!/bin/bash +set -e + +# This script is used for publishing latest(release) and develop(canary) +# container images of the operator. Script argument "tagged" must be passed to +# publish a new release and "develop" must be passed to publish a canary image. + +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