forked from conduktor/kafka-security-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0baa827
commit 0dfd05d
Showing
4 changed files
with
46 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,22 @@ | ||
language: scala | ||
sudo: required | ||
|
||
services: | ||
- docker | ||
|
||
scala: | ||
- 2.12.4 | ||
|
||
script: | ||
- ./test.sh | ||
- ./test.sh | ||
|
||
# Improvement: move logic out of docker_push.sh into .travis.yml | ||
deploy: | ||
provider: script | ||
script: bash docker_push.sh | ||
skip_cleanup: true | ||
# on: | ||
# all_branches: true | ||
# tags: true / false => has precendence over the branch condition | ||
# condition: "foo == bar && baz==bat" | ||
# repo: simplesteph/kafka-security-manager |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0
build-docker.sh → docker_build.sh
100755 → 100644
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/bash | ||
|
||
./docker_build.sh | ||
|
||
docker_push(){ | ||
echo "Pushing tag $1 to docker hub" | ||
docker tag "simplesteph/kafka-security-manager:latest" "simplesteph/kafka-security-manager:$1" | ||
docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"; | ||
docker push "simplesteph/kafka-security-manager:$1" | ||
} | ||
|
||
# TRAVIS_TAG: If the current build is for a git tag, this variable is set to the tag’s name. | ||
# TRAVIS_PULL_REQUEST_BRANCH: if the current job is a pull request, the name of the branch from which the PR originated. | ||
|
||
if [[ "$TRAVIS_PULL_REQUEST_BRANCH" == "" ]]; then | ||
if [[ "$TRAVIS_TAG" =! "" ]]; then | ||
# Tagging should trigger a release in Docker Hub, that's immutable. | ||
echo "git tag action, push the tag" | ||
docker_push "$TRAVIS_TAG-release" | ||
elif [[ "$TRAVIS_BRANCH" == "master" ]]; then | ||
# we push to latest when master is built and that's not a pull request | ||
echo "master build, push to latest" | ||
docker_push "latest" | ||
elif [[ "$TRAVIS_BRANCH" ~= "v*" ]]; then | ||
# this is a version branch and we push it. | ||
echo "branch build, push to branch-latest" | ||
docker_push "$TRAVIS_BRANCH-latest" | ||
fi; | ||
fi; |