This repository has been archived by the owner on Dec 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 138
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from microservices-demo/update-load-test
Update load test
- Loading branch information
Showing
4 changed files
with
133 additions
and
52 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,25 @@ | ||
language: generic | ||
sudo: required | ||
services: | ||
- docker | ||
|
||
install: true | ||
|
||
env: | ||
- GROUP=weaveworksdemos COMMIT=$TRAVIS_COMMIT TAG=$TRAVIS_TAG REPO=load-test; | ||
|
||
script: | ||
- set -e | ||
- curl -o docker-compose.yml -sSL https://raw.githubusercontent.com/microservices-demo/microservices-demo/master/deploy/docker-compose/docker-compose.yml | ||
- docker-compose -f docker-compose.yml up -d | ||
- docker build -t weaveworksdemos/load-test . | ||
- docker run --rm -t weaveworksdemos/load-test -d 120 -h edge-router -c 3 -r 500 | ||
|
||
after_success: | ||
- set -e; | ||
- 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; | ||
- ./push.sh |
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,55 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -ev | ||
|
||
if [[ -z "$GROUP" ]] ; then | ||
echo "Cannot find GROUP env var" | ||
exit 1 | ||
fi | ||
|
||
if [[ -z "$COMMIT" ]] ; then | ||
echo "Cannot find COMMIT env var" | ||
exit 1 | ||
fi | ||
|
||
push() { | ||
DOCKER_PUSH=1; | ||
while [ $DOCKER_PUSH -gt 0 ] ; do | ||
echo "Pushing $1"; | ||
docker push $1; | ||
DOCKER_PUSH=$(echo $?); | ||
if [[ "$DOCKER_PUSH" -gt 0 ]] ; then | ||
echo "Docker push failed with exit code $DOCKER_PUSH"; | ||
fi; | ||
done; | ||
} | ||
|
||
tag_and_push_all() { | ||
if [[ -z "$1" ]] ; then | ||
echo "Please pass the tag" | ||
exit 1 | ||
else | ||
TAG=$1 | ||
fi | ||
for m in ./docker/*/; do | ||
REPO=${GROUP}/$(basename $m) | ||
if [[ "$COMMIT" != "$TAG" ]]; then | ||
docker tag ${REPO}:${COMMIT} ${REPO}:${TAG} | ||
fi | ||
push "$REPO:$TAG"; | ||
done; | ||
} | ||
|
||
# Always push commit | ||
tag_and_push_all $COMMIT | ||
|
||
# Push snapshot when in master | ||
if [ "$TRAVIS_BRANCH" == "master" ]; then | ||
tag_and_push_all snapshot | ||
fi; | ||
|
||
# Push tag and latest when tagged | ||
if [ -n "$TRAVIS_TAG" ]; then | ||
tag_and_push_all ${TRAVIS_TAG} | ||
tag_and_push_all 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