File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -105,6 +105,7 @@ definitions:
105105 - node-2024-02-x
106106 - cypress-2024-02-x
107107 script :
108+ - apt-get update && apt-get install -y curl
108109 - export HASH_COMMIT=${BITBUCKET_COMMIT:0:8}
109110 - echo "Running tests for commit $HASH_COMMIT"
110111 - export DSPACE_REST_HOST=${E2E_RUNNER_HOST}
@@ -120,6 +121,27 @@ definitions:
120121 - export CYPRESS_CACHE_FOLDER=~/.cache/Cypress
121122 - export CHROME_FLAGS="--no-sandbox --disable-dev-shm-usage --disable-gpu"
122123 - export NODE_OPTIONS="--max-old-space-size=4096"
124+ - |
125+ MAX_RETRIES=10
126+ RETRY_COUNT=0
127+ SUCCESS=false
128+ while [ $RETRY_COUNT -lt $MAX_RETRIES ]; do
129+ echo "Pinging REST endpoint... (Attempt $((RETRY_COUNT+1)))"
130+ STATUS_CODE=$(curl -s -o /dev/null -w "%{http_code}" "https://$DSPACE_REST_HOST$DSPACE_REST_NAMESPACE")
131+ if [ "$STATUS_CODE" -lt 400 ]; then
132+ echo "REST endpoint is up! Status code: $STATUS_CODE"
133+ SUCCESS=true
134+ break
135+ else
136+ echo "REST endpoint not ready (Status code: $STATUS_CODE). Retrying in 60 seconds..."
137+ RETRY_COUNT=$((RETRY_COUNT+1))
138+ sleep 60
139+ fi
140+ done
141+ if [ "$SUCCESS" = "false" ]; then
142+ echo "REST endpoint did not become available after $MAX_RETRIES attempts. Failing the build."
143+ exit 1
144+ fi
123145 - npx cypress install
124146 - yarn serve:ssr &
125147 - echo "Waiting for server to start..."
You can’t perform that action at this time.
0 commit comments