Skip to content
This repository has been archived by the owner on Jan 26, 2023. It is now read-only.

Commit

Permalink
Merge pull request #5 from EOEPCA/develop
Browse files Browse the repository at this point in the history
Develop - Even though it has a failing stage
  • Loading branch information
josejulioramos authored Feb 13, 2020
2 parents 9bc117f + 1c81b4e commit 0a93130
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 13 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ jobs:
install: skip
script: travis/build.sh

- stage: container creation and publishing
install: skip
script: travis/containerCreation.sh

- stage: smoke and acceptance test
install: skip # without this there's a `git clone` and `gradlew assemble` executed!
script: travis/acceptanceTest.sh
Expand Down
4 changes: 2 additions & 2 deletions travis/acceptanceTest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
set -euov pipefail

docker run -d --rm -p 8080:7000 --name template-svc $DOCKER_USERNAME/template-service:travis_${TRAVIS_BRANCH}_$TRAVIS_BUILD_NUMBER
sleep 15 # wait for startup
curl -s http://localhost:8080/search | jq '.' # trivial smoke test
sleep 30 # wait for startup
curl -s http://localhost:8080/search | jq '.' # trivial smoke test
9 changes: 0 additions & 9 deletions travis/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,3 @@ set -euov pipefail
# compiles, runs unit tests and packages as a single jar
./gradlew build

# Create a Docker image and tag it as 'travis_<build number>'
buildTag=travis_${TRAVIS_BRANCH}_$TRAVIS_BUILD_NUMBER

docker build -t eoepca/template-service .
docker tag eoepca/template-service $DOCKER_USERNAME/template-service:$buildTag

echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin

docker push $DOCKER_USERNAME/template-service:$buildTag # defaults to docker hub
16 changes: 16 additions & 0 deletions travis/containerCreation.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash

# fail fast settings from https://dougrichardson.org/2018/08/03/fail-fast-bash-scripting.html
set -euov pipefail

./gradlew shadowJar

# Create a Docker image and tag it as 'travis_<build number>'
buildTag=travis_${TRAVIS_BRANCH}_$TRAVIS_BUILD_NUMBER

docker build -t eoepca/template-service .
docker tag eoepca/template-service $DOCKER_USERNAME/template-service:$buildTag

echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin

docker push $DOCKER_USERNAME/template-service:$buildTag # defaults to docker hub
4 changes: 2 additions & 2 deletions travis/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
docker pull $DOCKER_USERNAME/template-service:travis_${TRAVIS_BRANCH}_$TRAVIS_BUILD_NUMBER # have to pull locally in order to tag as a release

# Tag and push as a Release
docker tag $DOCKER_USERNAME/template-service:travis_${TRAVIS_BRANCH}_$TRAVIS_BUILD_NUMBER $DOCKER_USERNAME/template-service:release_$TRAVIS_BUILD_NUMBER
docker push $DOCKER_USERNAME/template-service:release_$TRAVIS_BUILD_NUMBER
docker tag $DOCKER_USERNAME/template-service:travis_${TRAVIS_BRANCH}_$TRAVIS_BUILD_NUMBER $DOCKER_USERNAME/template-service:release_$TRAVIS_TAG
docker push $DOCKER_USERNAME/template-service:release_$TRAVIS_TAG

# Tag and push as `latest`
docker tag $DOCKER_USERNAME/template-service:travis_${TRAVIS_BRANCH}_$TRAVIS_BUILD_NUMBER $DOCKER_USERNAME/template-service:latest
Expand Down

0 comments on commit 0a93130

Please sign in to comment.