From fc9ab3b067342b576e55626afd02b26eeacb6042 Mon Sep 17 00:00:00 2001 From: Ioannis Igoumenos Date: Tue, 14 Apr 2026 10:15:04 +0000 Subject: [PATCH] fixing github actions steps and configuration --- .github/workflows/registry-ci.yml | 38 +++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/.github/workflows/registry-ci.yml b/.github/workflows/registry-ci.yml index 1bd81b655..7ddf4c32b 100644 --- a/.github/workflows/registry-ci.yml +++ b/.github/workflows/registry-ci.yml @@ -47,6 +47,11 @@ jobs: MARIADB_USER: test_user MARIADB_PASSWORD: test_password MARIADB_ROOT_PASSWORD: root_password + options: >- + --health-cmd "${{ matrix.db.health_cmd }}" + --health-interval 10s + --health-timeout 5s + --health-retries 20 env: COMANAGE_REGISTRY_DIR: /srv/comanage-registry @@ -55,8 +60,8 @@ jobs: DB_ENGINE: ${{ matrix.db.engine }} # DB service connection info (because you publish ports) - COMANAGE_REGISTRY_DATABASE_HOST: db - COMANAGE_REGISTRY_DATABASE_PORT: ${{ matrix.db.port }} +# COMANAGE_REGISTRY_DATABASE_HOST: db +# COMANAGE_REGISTRY_DATABASE_PORT: ${{ matrix.db.port }} # Values used by your PHPUnit setup test COMANAGE_REGISTRY_ADMIN_GIVEN_NAME: Admin @@ -178,6 +183,35 @@ jobs: ;; esac + - name: Export DB host/port (service container IP) + shell: bash + run: | + set -euxo pipefail + + DB_HOST="$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' '${{ job.services.db.id }}')" + echo "Resolved DB_HOST=${DB_HOST}" + + case "${DB_ENGINE}" in + postgres) DB_PORT=5432 ;; + mysql|mariadb) DB_PORT=3306 ;; + *) echo "Unknown DB_ENGINE=${DB_ENGINE}"; exit 1 ;; + esac + + echo "COMANAGE_REGISTRY_DATABASE_HOST=${DB_HOST}" >> "$GITHUB_ENV" + echo "COMANAGE_REGISTRY_DATABASE_PORT=${DB_PORT}" >> "$GITHUB_ENV"` + + - name: Smoke test DB TCP port + shell: bash + run: | + set -euxo pipefail + php -r ' + $h=getenv("COMANAGE_REGISTRY_DATABASE_HOST"); $p=(int)getenv("COMANAGE_REGISTRY_DATABASE_PORT"); + $fp=@fsockopen($h,$p,$errno,$errstr,5); + if(!$fp){fwrite(STDERR,"TCP connect failed: $errno $errstr\n"); exit(1);} + fclose($fp); + echo "TCP connect OK to $h:$p\n"; + ' + - name: Create local/config/database.php placeholder shell: bash run: |