Skip to content

Commit

Permalink
Add healthcheck to the docker hub (microservices-demo#550)
Browse files Browse the repository at this point in the history
* Add healthcheck to the docker hub

* Forgot to add file

* Use variable for folder
  • Loading branch information
vlal authored and pidster committed Jan 16, 2017
1 parent cdc2111 commit 60d129a
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 37 deletions.
38 changes: 1 addition & 37 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,43 +23,7 @@ script:

after_success:
- export GROUP=weaveworksdemos
- if [ "$TRAVIS_EVENT_TYPE" == "cron" ]; then
echo "Not pushing artifacts in cron jobs";
exit 0;
fi;
- if [ -z "$DOCKER_PASS" ] ; then
echo "This is a build triggered by an external PR. Skipping docker push.";
exit 0;
fi;
- docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS
- export REPO=${GROUP}/$(basename openapi); # build openapi testing image
- echo "Building ${REPO}:$TRAVIS_COMMIT";
- docker build -t ${REPO}:$TRAVIS_COMMIT ./openapi; DOCKER_EXIT=$(echo $?); if [[ "$DOCKER_EXIT" > 0 ]] ; then
echo "Docker build failed with exit code $DOCKER_EXIT";
exit 1;
fi;
- export DOCKER_PUSH=1;
- while [ "$DOCKER_PUSH" -gt 0 ] ; do
echo "Pushing $REPO:$TRAVIS_COMMIT";
docker push $REPO:$TRAVIS_COMMIT;
DOCKER_PUSH=$(echo $?);
if [[ "$DOCKER_PUSH" -gt 0 ]] ; then
echo "Docker push failed with exit code $DOCKER_PUSH";
fi;
done;
- if [ "$TRAVIS_BRANCH" == "master" ]; then
docker tag $REPO:$TRAVIS_COMMIT $REPO:snapshot;
echo "Pushing $REPO:snapshot";
docker push $REPO:snapshot;
fi;
- if [ ! -z "$TRAVIS_TAG" ];
then docker tag $REPO:$TRAVIS_COMMIT $REPO:$TRAVIS_TAG;
docker push $REPO:$TRAVIS_TAG;
docker tag $REPO:$TRAVIS_COMMIT $REPO:latest;
docker push $REPO:latest;
fi;
- mkdir cfn-to-publish
- jq ".Description += \" (microservices-demo/microservices-demo@${TRAVIS_COMMIT})\"" "deploy/aws-ecs/cloudformation.json" > cfn-to-publish/microservices-demo.json
- ./push.sh

deploy:
provider: s3
Expand Down
File renamed without changes.
File renamed without changes.
46 changes: 46 additions & 0 deletions push.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/usr/bin/env bash

if [ "$TRAVIS_EVENT_TYPE" == "cron" ]; then
echo "Not pushing artifacts in cron jobs";
exit 0;
fi;

if [ -z "$DOCKER_PASS" ] ; then
echo "This is a build triggered by an external PR. Skipping docker push.";
exit 0;
fi;


docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS

for svc in openapi healthcheck; do
export REPO=${GROUP}/$(basename $svc);
echo "Building ${REPO}:$TRAVIS_COMMIT";
docker build -t ${REPO}:$TRAVIS_COMMIT ./$svc; DOCKER_EXIT=$(echo $?); if [[ "$DOCKER_EXIT" > 0 ]] ; then
echo "Docker build failed with exit code $DOCKER_EXIT";
exit 1;
fi;
export DOCKER_PUSH=1;
while [ "$DOCKER_PUSH" -gt 0 ] ; do
echo "Pushing $REPO:$TRAVIS_COMMIT";
docker push $REPO:$TRAVIS_COMMIT;
DOCKER_PUSH=$(echo $?);
if [[ "$DOCKER_PUSH" -gt 0 ]] ; then
echo "Docker push failed with exit code $DOCKER_PUSH";
fi;
done;
if [ "$TRAVIS_BRANCH" == "master" ]; then
docker tag $REPO:$TRAVIS_COMMIT $REPO:snapshot;
echo "Pushing $REPO:snapshot";
docker push $REPO:snapshot;
fi;
if [ ! -z "$TRAVIS_TAG" ];
then docker tag $REPO:$TRAVIS_COMMIT $REPO:$TRAVIS_TAG;
docker push $REPO:$TRAVIS_TAG;
docker tag $REPO:$TRAVIS_COMMIT $REPO:latest;
docker push $REPO:latest;
fi;
done

mkdir cfn-to-publish
jq ".Description += \" (microservices-demo/microservices-demo@${TRAVIS_COMMIT})\"" "deploy/aws-ecs/cloudformation.json" > cfn-to-publish/microservices-demo.json

0 comments on commit 60d129a

Please sign in to comment.