Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement Support for Travis CI/CD (#8)
- Loading branch information
Showing
8 changed files
with
102 additions
and
35 deletions.
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 |
---|---|---|
@@ -0,0 +1,63 @@ | ||
sudo: required | ||
env: | ||
- DOCKER_IMAGE_NAME=cloudposse/github-authorized-keys | ||
services: | ||
- docker | ||
install: | ||
- |- | ||
docker login \ | ||
--email="$DOCKER_HUB_EMAIL" \ | ||
--username="$DOCKER_HUB_USERNAME" \ | ||
--password="$DOCKER_HUB_PASSWORD" | ||
- pip install docker-compose | ||
|
||
script: | ||
- |- | ||
export ETCD_IP=$(ifconfig eth0 | grep 'inet addr' | cut -d: -f2 | awk '{print $1}') | ||
- docker-compose -f docker-compose-test.yaml up -d | ||
|
||
- |- | ||
docker build --tag test \ | ||
--build-arg RUN_TESTS=1 \ | ||
--build-arg TEST_GITHUB_API_TOKEN=${GITHUB_API_TOKEN} \ | ||
--build-arg TEST_GITHUB_ORGANIZATION=${GITHUB_ORGANIZATION} \ | ||
--build-arg TEST_GITHUB_TEAM=${GITHUB_TEAM} \ | ||
--build-arg TEST_GITHUB_TEAM_ID=${GITHUB_TEAM_ID} \ | ||
--build-arg TEST_GITHUB_USER=${GITHUB_USER} \ | ||
--build-arg TEST_ETCD_ENDPOINT=http://${ETCD_IP}:2379 \ | ||
./ | ||
after_success: | ||
- docker build -t $DOCKER_IMAGE_NAME . | ||
|
||
- |- | ||
if [ ! -z "$TRAVIS_TAG" ]; then \ | ||
docker tag $DOCKER_IMAGE_NAME $DOCKER_IMAGE_NAME:$TRAVIS_TAG && \ | ||
docker push $DOCKER_IMAGE_NAME:$TRAVIS_TAG; \ | ||
fi | ||
- |- | ||
if [ ! -z "$TRAVIS_PULL_REQUEST_BRANCH" ]; then \ | ||
docker tag $DOCKER_IMAGE_NAME $DOCKER_IMAGE_NAME:pr-$TRAVIS_PULL_REQUEST_BRANCH && \ | ||
docker push $DOCKER_IMAGE_NAME:pr-$TRAVIS_PULL_REQUEST_BRANCH; \ | ||
fi | ||
- |- | ||
if [[ -z "$TRAVIS_PULL_REQUEST_BRANCH" && ! -z "$TRAVIS_BRANCH" ]]; then \ | ||
docker tag $DOCKER_IMAGE_NAME $DOCKER_IMAGE_NAME:$TRAVIS_BRANCH && \ | ||
docker push $DOCKER_IMAGE_NAME:$TRAVIS_BRANCH; \ | ||
fi | ||
- |- | ||
if [[ -z "$TRAVIS_TAG" && -z "$TRAVIS_PULL_REQUEST_BRANCH" && -z "$TRAVIS_BRANCH" ]]; then \ | ||
docker tag $DOCKER_IMAGE_NAME $DOCKER_IMAGE_NAME:latest && \ | ||
docker push $DOCKER_IMAGE_NAME:latest; \ | ||
fi | ||
- |- | ||
if [[ -z "$TRAVIS_PULL_REQUEST_BRANCH" ]] && [[ "$TRAVIS_BRANCH" == "master" ]]; then \ | ||
docker tag $DOCKER_IMAGE_NAME $DOCKER_IMAGE_NAME:latest && \ | ||
docker push $DOCKER_IMAGE_NAME:latest; \ | ||
fi |
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
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
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
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
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
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,14 @@ | ||
version: '2' | ||
|
||
services: | ||
etcd: | ||
image: quay.io/coreos/etcd:v2.3.7 | ||
command: | ||
- "--advertise-client-urls=http://0.0.0.0:2379,http://0.0.0.0:4001" | ||
- "--listen-client-urls=http://0.0.0.0:2379,http://0.0.0.0:4001" | ||
ports: | ||
- "2379:2379" | ||
- "2380:2380" | ||
- "4001:4001" | ||
- "7001:7001" | ||
restart: always |
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