diff --git a/Jenkinsfile b/Jenkinsfile index ead8478..8cef32a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,4 +1,7 @@ +properties([disableConcurrentBuilds()]) + node('linux') { + def image_name = 'statusteam/universal-links-handler' def commit def image @@ -12,6 +15,12 @@ node('linux') { image = docker.build(image_name + ':' + commit) } + stage('Tests') { + image.withRun('-p 8080:80 -e PORT=80') { c -> + sh 'tests/run.sh -u 127.0.0.1:8080' + } + } + stage('Publish') { withDockerRegistry([ credentialsId: "dockerhub-statusteam-auto", url: "" diff --git a/README.md b/README.md index 5a242fc..179f224 100644 --- a/README.md +++ b/README.md @@ -48,3 +48,5 @@ Then you can run `bash tests/run.sh -u localhost:8080` or to run against against Uses the awesome `https://github.com/robwhitby/shakedown` ## Deployment + +The code is automatically deployed when pushed to master diff --git a/tests/run.sh b/tests/run.sh old mode 100644 new mode 100755 index b3a7a75..c744a31 --- a/tests/run.sh +++ b/tests/run.sh @@ -1,6 +1,12 @@ #!/bin/bash + source tests/shakedown.sh +until $(curl --output /dev/null --silent --head --fail $BASE_URL/health); do + printf '.' + sleep 1 +done + shakedown GET /.well-known/assetlinks.json status 200 content_type 'application/json' diff --git a/tests/shakedown.sh b/tests/shakedown.sh old mode 100644 new mode 100755