From bc2d83fb2c607d764019eeeb00001cf5172c34c5 Mon Sep 17 00:00:00 2001 From: missinglink Date: Wed, 20 Nov 2019 16:34:37 +0100 Subject: [PATCH] fix(CI): update elastic_wait command usage --- scripts/elastic_wait.sh | 12 +++++++++--- scripts/setup_ci.sh | 4 ++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/scripts/elastic_wait.sh b/scripts/elastic_wait.sh index c8b858e6..c8df72cf 100644 --- a/scripts/elastic_wait.sh +++ b/scripts/elastic_wait.sh @@ -1,5 +1,11 @@ +set -e + function elastic_status(){ - curl --output /dev/null --silent --write-out "%{http_code}" "http://${ELASTIC_HOST:-localhost:9200}" || true; + curl \ + --output /dev/null \ + --silent \ + --write-out "%{http_code}" \ + "http://${ELASTIC_HOST:-localhost:9200}" || true; } function elastic_wait(){ @@ -9,7 +15,7 @@ function elastic_wait(){ i=1 while [[ "$i" -le "$retry_count" ]]; do if [[ $(elastic_status) -eq 200 ]]; then - echo "Elasticsearch up!" + echo exit 0 fi sleep 2 @@ -20,4 +26,4 @@ function elastic_wait(){ echo echo "Elasticsearch did not come up, check configuration" exit 1 -} \ No newline at end of file +} diff --git a/scripts/setup_ci.sh b/scripts/setup_ci.sh index b540a7cb..32e2530e 100755 --- a/scripts/setup_ci.sh +++ b/scripts/setup_ci.sh @@ -37,7 +37,7 @@ fi # wait for server to boot up # logs show that on travis-ci it can take ~17s to boot an ES6 server source "${BASH_SOURCE%/*}/elastic_wait.sh" -elastic_wait +(elastic_wait) # set the correct esclient.apiVersion in pelias.json v=( ${ES_VERSION//./ } ) # split version number on '.' @@ -48,4 +48,4 @@ echo "--- pelias.json ---" cat ~/pelias.json echo "--- elasticsearch.yml ---" -cat /tmp/elasticsearch/config/elasticsearch.yml \ No newline at end of file +cat /tmp/elasticsearch/config/elasticsearch.yml