From cd25a7969431d4dedcbb1474c0c146aeb78f85eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Wed, 19 Feb 2025 15:29:42 +0100 Subject: [PATCH 1/6] Improve tests OPR setup --- .github/workflows/tests.yml | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9419302dbc..20147bc3a5 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -170,6 +170,29 @@ jobs: docker compose up -d sleep 30 + - name: Wait for Open Runtimes + run: | + max_attempts=25 + delay=5 + attempt=0 + success=0 + while [ $attempt -lt $max_attempts ]; do + response=$(docker compose exec appwrite sh -c "curl -I \$_APP_EXECUTOR_HOST/health -H \"Authorization: Bearer \$_APP_EXECUTOR_SECRET\"") + if echo $response | grep -q '200 OK'; then + success=1 + break + else + echo "Health check failed, retrying..." + sleep $delay + ((attempt++)) + fi + done + + if [ $success -eq 0 ]; then + echo "Failed to start Open Runtimes" + exit 1 + fi + - name: Run ${{ matrix.service }} tests with Project table mode run: | echo "Using project tables" @@ -231,7 +254,7 @@ jobs: run: | docker load --input /tmp/${{ env.IMAGE }}.tar docker compose up -d - sleep 60 + sleep 30 - name: Run ${{ matrix.service }} tests with ${{ matrix.tables-mode }} table mode run: | @@ -244,9 +267,6 @@ jobs: export _APP_DATABASE_SHARED_TABLES=database_db_main export _APP_DATABASE_SHARED_TABLES_V1= fi - - echo 'Sleep 1 minute, as temporary fix for v4rc executor startup (image pulling)' - sleep 60 docker compose exec -T \ -e _APP_DATABASE_SHARED_TABLES \ From 322b7261961dab2e7aab2e7d5a160196a30e50d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Wed, 19 Feb 2025 15:37:43 +0100 Subject: [PATCH 2/6] Fix test --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 20147bc3a5..1c9a4d49c7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -177,7 +177,7 @@ jobs: attempt=0 success=0 while [ $attempt -lt $max_attempts ]; do - response=$(docker compose exec appwrite sh -c "curl -I \$_APP_EXECUTOR_HOST/health -H \"Authorization: Bearer \$_APP_EXECUTOR_SECRET\"") + response=$(command "docker compose exec appwrite sh -c \"curl -I \$_APP_EXECUTOR_HOST/health -H \\"Authorization: Bearer \$_APP_EXECUTOR_SECRET\\"\")" || echo '0') if echo $response | grep -q '200 OK'; then success=1 break From 4a0d33213a4b140cd67b4972feb53c9ff1ebf8b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Wed, 19 Feb 2025 15:50:16 +0100 Subject: [PATCH 3/6] Fix tests --- .github/workflows/tests.yml | 55 ++++++++++++++++++++++++++++--------- 1 file changed, 42 insertions(+), 13 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1c9a4d49c7..e6cdcc4616 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -172,27 +172,30 @@ jobs: - name: Wait for Open Runtimes run: | - max_attempts=25 - delay=5 + max_attempts=180 attempt=0 success=0 while [ $attempt -lt $max_attempts ]; do - response=$(command "docker compose exec appwrite sh -c \"curl -I \$_APP_EXECUTOR_HOST/health -H \\"Authorization: Bearer \$_APP_EXECUTOR_SECRET\\"\")" || echo '0') - if echo $response | grep -q '200 OK'; then - success=1 - break - else - echo "Health check failed, retrying..." - sleep $delay - ((attempt++)) - fi + command="curl -s \$_APP_EXECUTOR_HOST/health -H \"Authorization: Bearer \$_APP_EXECUTOR_SECRET\"" + response=$(docker compose exec appwrite sh -c "$command") + + if [[ $response == *"runtimes"* ]]; then + success=1 + break + else + echo "Health check failed, retrying..." + sleep 1 + ((attempt++)) + fi done if [ $success -eq 0 ]; then - echo "Failed to start Open Runtimes" - exit 1 + echo "Failed to start Open Runtimes executor" + exit 1 fi + echo "Open Runtimes executor started" + - name: Run ${{ matrix.service }} tests with Project table mode run: | echo "Using project tables" @@ -256,6 +259,32 @@ jobs: docker compose up -d sleep 30 + - name: Wait for Open Runtimes + run: | + max_attempts=180 + attempt=0 + success=0 + while [ $attempt -lt $max_attempts ]; do + command="curl -s \$_APP_EXECUTOR_HOST/health -H \"Authorization: Bearer \$_APP_EXECUTOR_SECRET\"" + response=$(docker compose exec appwrite sh -c "$command") + + if [[ $response == *"runtimes"* ]]; then + success=1 + break + else + echo "Health check failed, retrying..." + sleep 1 + ((attempt++)) + fi + done + + if [ $success -eq 0 ]; then + echo "Failed to start Open Runtimes executor" + exit 1 + fi + + echo "Open Runtimes executor started" + - name: Run ${{ matrix.service }} tests with ${{ matrix.tables-mode }} table mode run: | if [ "${{ matrix.tables-mode }}" == "Shared V1" ]; then From f0d8c7382b859f6fd58d3db6c33f95770cdcf6df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Thu, 20 Feb 2025 12:19:32 +0100 Subject: [PATCH 4/6] Simplify YML file --- .github/scripts/ensure-executor.sh | 28 +++++++++++++++++ .github/workflows/tests.yml | 48 ++---------------------------- 2 files changed, 30 insertions(+), 46 deletions(-) create mode 100644 .github/scripts/ensure-executor.sh diff --git a/.github/scripts/ensure-executor.sh b/.github/scripts/ensure-executor.sh new file mode 100644 index 0000000000..4646e8cf5a --- /dev/null +++ b/.github/scripts/ensure-executor.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +# Fail build if any command fails +set -e + +max_attempts=180 +attempt=0 +success=0 +while [ $attempt -lt $max_attempts ]; do + command="curl -s \$_APP_EXECUTOR_HOST/health -H \"Authorization: Bearer \$_APP_EXECUTOR_SECRET\"" + response=$(docker compose exec appwrite sh -c "$command") + + if [[ $response == *"runtimes"* ]]; then + success=1 + break + else + echo "Health check failed, retrying..." + sleep 1 + ((attempt++)) + fi +done + +if [ $success -eq 0 ]; then + echo "Failed to start Open Runtimes executor" + exit 1 +fi + +echo "Open Runtimes executor started" \ No newline at end of file diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e6cdcc4616..d6d9e78630 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -172,29 +172,7 @@ jobs: - name: Wait for Open Runtimes run: | - max_attempts=180 - attempt=0 - success=0 - while [ $attempt -lt $max_attempts ]; do - command="curl -s \$_APP_EXECUTOR_HOST/health -H \"Authorization: Bearer \$_APP_EXECUTOR_SECRET\"" - response=$(docker compose exec appwrite sh -c "$command") - - if [[ $response == *"runtimes"* ]]; then - success=1 - break - else - echo "Health check failed, retrying..." - sleep 1 - ((attempt++)) - fi - done - - if [ $success -eq 0 ]; then - echo "Failed to start Open Runtimes executor" - exit 1 - fi - - echo "Open Runtimes executor started" + sh .github/scripts/ensure-executor.sh - name: Run ${{ matrix.service }} tests with Project table mode run: | @@ -261,29 +239,7 @@ jobs: - name: Wait for Open Runtimes run: | - max_attempts=180 - attempt=0 - success=0 - while [ $attempt -lt $max_attempts ]; do - command="curl -s \$_APP_EXECUTOR_HOST/health -H \"Authorization: Bearer \$_APP_EXECUTOR_SECRET\"" - response=$(docker compose exec appwrite sh -c "$command") - - if [[ $response == *"runtimes"* ]]; then - success=1 - break - else - echo "Health check failed, retrying..." - sleep 1 - ((attempt++)) - fi - done - - if [ $success -eq 0 ]; then - echo "Failed to start Open Runtimes executor" - exit 1 - fi - - echo "Open Runtimes executor started" + sh .github/scripts/ensure-executor.sh - name: Run ${{ matrix.service }} tests with ${{ matrix.tables-mode }} table mode run: | From f5f37d6a796aec1ad2b9047a258309e2bc9f638f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Thu, 20 Feb 2025 12:25:13 +0100 Subject: [PATCH 5/6] Simplify OPR startup check --- .github/scripts/ensure-executor.sh | 28 ---------------------------- .github/workflows/tests.yml | 12 ++++++++++-- 2 files changed, 10 insertions(+), 30 deletions(-) delete mode 100644 .github/scripts/ensure-executor.sh diff --git a/.github/scripts/ensure-executor.sh b/.github/scripts/ensure-executor.sh deleted file mode 100644 index 4646e8cf5a..0000000000 --- a/.github/scripts/ensure-executor.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh - -# Fail build if any command fails -set -e - -max_attempts=180 -attempt=0 -success=0 -while [ $attempt -lt $max_attempts ]; do - command="curl -s \$_APP_EXECUTOR_HOST/health -H \"Authorization: Bearer \$_APP_EXECUTOR_SECRET\"" - response=$(docker compose exec appwrite sh -c "$command") - - if [[ $response == *"runtimes"* ]]; then - success=1 - break - else - echo "Health check failed, retrying..." - sleep 1 - ((attempt++)) - fi -done - -if [ $success -eq 0 ]; then - echo "Failed to start Open Runtimes executor" - exit 1 -fi - -echo "Open Runtimes executor started" \ No newline at end of file diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d6d9e78630..9dc466ac78 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -171,8 +171,12 @@ jobs: sleep 30 - name: Wait for Open Runtimes + timeout-minutes: 3 run: | - sh .github/scripts/ensure-executor.sh + while ! docker compose logs openruntimes-executor | grep -q "Executor is ready."; do + echo "Waiting for Executor to come online" + sleep 1 + done - name: Run ${{ matrix.service }} tests with Project table mode run: | @@ -238,8 +242,12 @@ jobs: sleep 30 - name: Wait for Open Runtimes + timeout-minutes: 3 run: | - sh .github/scripts/ensure-executor.sh + while ! docker compose logs openruntimes-executor | grep -q "Executor is ready."; do + echo "Waiting for Executor to come online" + sleep 1 + done - name: Run ${{ matrix.service }} tests with ${{ matrix.tables-mode }} table mode run: | From e6a53a8c15bed5643c9c8f4b767092ab9e38626d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Thu, 20 Feb 2025 12:33:00 +0100 Subject: [PATCH 6/6] Enable sites on non-shared tables --- .github/workflows/tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9dc466ac78..fef758a613 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -145,6 +145,7 @@ jobs: Locale, Projects, Realtime, + Sites, Storage, Teams, Users,