From beae7e72716965994ab006b6f95fd019c4ff624a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ulises=20Gasc=C3=B3n?= Date: Thu, 18 Apr 2024 16:58:28 +0200 Subject: [PATCH] ci: improvements --- .github/workflows/integration-tests.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index e6ebcadd48..e9bef27a73 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -38,7 +38,10 @@ jobs: workflow_url=$(echo "$response" | jq -r '.workflow_runs[0].url') status="" - while [[ "$status" != "completed" ]]; do + start_time=$(date +%s) + timeout=$((10 * 60)) # timeout after 10 minutes + + while [[ "$status" != "completed" && $(( $(date +%s) - start_time )) -lt $timeout ]]; do echo "checking..." sleep 10 response=$(curl -H "Authorization: token $TOKEN" $workflow_url) @@ -46,9 +49,11 @@ jobs: echo "current status: $status" done - conclusion=$(echo "$response" | jq -r .conclusion) - echo "The conclusion of the workflow run is: $conclusion" - if [[ "$conclusion" != "success" ]]; then - echo "Workflow failed" + if [[ $(( $(date +%s) - start_time )) -ge $timeout ]]; then + echo "Workflow did not complete within the expected time" + fi + + if [[ "$status" != "completed" ]]; then + echo "Workflow failed. Current status: $status" exit 1 fi \ No newline at end of file