Skip to content
This repository has been archived by the owner on Nov 9, 2022. It is now read-only.
This repository is currently being migrated. It's locked while the migration is in progress.

Commit

Permalink
Fix develop image deployment
Browse files Browse the repository at this point in the history
The $TRAVIS_TAG variable is available for tagged branches only. Separate
tag deployments and branch deployments with their own docker tag
commands.
  • Loading branch information
darkowlzz committed Mar 25, 2019
1 parent 9e673ae commit b3c69a8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
24 changes: 11 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
11 changes: 11 additions & 0 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit b3c69a8

Please sign in to comment.