Skip to content

Commit

Permalink
extract build logic from .travis.yml to 'build.sh'
Browse files Browse the repository at this point in the history
main reason is that Travis will always execute ALL commands under the "script" block, even if some of them failed.
see: travis-ci/travis-ci#1066
  • Loading branch information
Arik Kfir committed Sep 23, 2017
1 parent 145cb68 commit 6c7c61a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
10 changes: 1 addition & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,10 @@ language: generic
sudo: required
services:
- docker

before_script:
- docker login -u "${DOCKERHUB_USERNAME}" -p "${DOCKERHUB_PASSWORD}"
script:
- docker build -t infolinks/k8s-cloudflared:${TRAVIS_COMMIT} .
- |
if [[ ${TRAVIS_TAG} =~ ^v[0-9]+$ ]]; then
docker tag infolinks/k8s-cloudflared:${TRAVIS_COMMIT} infolinks/k8s-cloudflared:${TRAVIS_TAG}
docker push infolinks/k8s-cloudflared:${TRAVIS_TAG}
docker tag infolinks/k8s-cloudflared:${TRAVIS_COMMIT} infolinks/k8s-cloudflared:latest
docker push infolinks/k8s-cloudflared:latest
fi
- .travis/build.sh
after_script:
- |
if [[ "${TRAVIS_BRANCH}" == "master" ]]; then
Expand Down
12 changes: 12 additions & 0 deletions .travis/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

set -e

docker build -t infolinks/k8s-cloudflared:${TRAVIS_COMMIT} .

if [[ ${TRAVIS_TAG} =~ ^v[0-9]+$ ]]; then
docker tag infolinks/k8s-cloudflared:${TRAVIS_COMMIT} infolinks/k8s-cloudflared:${TRAVIS_TAG}
docker push infolinks/k8s-cloudflared:${TRAVIS_TAG}
docker tag infolinks/k8s-cloudflared:${TRAVIS_COMMIT} infolinks/k8s-cloudflared:latest
docker push infolinks/k8s-cloudflared:latest
fi

0 comments on commit 6c7c61a

Please sign in to comment.