From 368ea75e3856258a518ff5357a0b3059d2fb5ab9 Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Thu, 25 Jun 2026 13:24:15 +0530 Subject: [PATCH] ci: address self-review findings - Wire up warm-bench: set BENCH_CACHE_DIR on the setup job so the bench-base cache actually activates (was inert with no dir set, so every run did a full bench init). Lives on the node-local bench-staging hostPath; any miss/failure still falls back to a full init. - run_ci_step: capture the timeout exit code under `set -e` (the previous `timeout ...` + `ec=$?` aborted at the timeout line on failure, skipping ::endgroup:: and the exit-code return). - Raise the per-step timeout 600s -> 1800s so a contended reinstall isn't killed before the 40-min job timeout. - Propagate DB through the su re-exec in start-db.sh / hydrate.sh so a DB=postgres invocation can't silently fall back to the mariadb branch. - Simplify the coverage job `if` to the equivalent plain non-PR gate. --- .github/helper/hydrate.sh | 2 +- .github/helper/install.sh | 4 ++-- .github/helper/start-db.sh | 2 +- .github/workflows/server-tests-mariadb.yml | 3 ++- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/helper/hydrate.sh b/.github/helper/hydrate.sh index cadf5c0ac6d..1372bc393a3 100755 --- a/.github/helper/hydrate.sh +++ b/.github/helper/hydrate.sh @@ -16,7 +16,7 @@ db_host="${DB_HOST:-127.0.0.1}" # install.sh. The workflow untar'd as root with -p, so the files are already owned by ci. if [ "$(id -u)" = "0" ] && [ "${SKIP_SYSTEM_SETUP:-0}" = "1" ] && [ "$ci_user" != "root" ]; then exec su -m "$ci_user" -s /bin/bash -c \ - "ERPNEXT_CI_USER='$ci_user' DB_HOST='$db_host' bash '$0'" + "ERPNEXT_CI_USER='$ci_user' DB_HOST='$db_host' DB='${DB:-}' bash '$0'" fi cd ~/frappe-bench diff --git a/.github/helper/install.sh b/.github/helper/install.sh index bb7c85d88e0..34e777506c9 100644 --- a/.github/helper/install.sh +++ b/.github/helper/install.sh @@ -74,8 +74,8 @@ run_ci_step() { echo "::group::${label}" date -u - timeout --foreground "${CI_INSTALL_STEP_TIMEOUT:-600}" "$@" - local exit_code=$? + local exit_code=0 + timeout --foreground "${CI_INSTALL_STEP_TIMEOUT:-1800}" "$@" || exit_code=$? date -u echo "::endgroup::" return "$exit_code" diff --git a/.github/helper/start-db.sh b/.github/helper/start-db.sh index e99d44babe1..507c33bb7e4 100755 --- a/.github/helper/start-db.sh +++ b/.github/helper/start-db.sh @@ -19,7 +19,7 @@ ci_user="${ERPNEXT_CI_USER:-frappe}" # refused anyway). Mirrors install.sh's user switch. if [ "$(id -u)" = "0" ] && [ "${SKIP_SYSTEM_SETUP:-0}" = "1" ] && [ "$ci_user" != "root" ]; then exec su -m "$ci_user" -s /bin/bash -c \ - "ERPNEXT_CI_USER='$ci_user' CI_DB_DATADIR='${CI_DB_DATADIR:-}' bash '$0'" + "ERPNEXT_CI_USER='$ci_user' CI_DB_DATADIR='${CI_DB_DATADIR:-}' DB='${DB:-}' bash '$0'" fi # --- PostgreSQL (GitHub-hosted CI): run in-runner on a PGDATA so it bakes into the artifact, diff --git a/.github/workflows/server-tests-mariadb.yml b/.github/workflows/server-tests-mariadb.yml index 68304f5fefd..680639ab6ea 100644 --- a/.github/workflows/server-tests-mariadb.yml +++ b/.github/workflows/server-tests-mariadb.yml @@ -106,6 +106,7 @@ jobs: WKHTMLTOX_DEB: /tmp/wkhtmltox.deb SKIP_SYSTEM_SETUP: "1" SKIP_WKHTMLTOX_SETUP: "1" + BENCH_CACHE_DIR: /opt/ci-bench-staging/base-cache # Clean shutdown (consistent InnoDB datadir), then stage it inside the bench for packaging. - name: Stop DB and stage datadir @@ -201,7 +202,7 @@ jobs: coverage: name: Coverage Wrap Up needs: [test] - if: ${{ always() && github.event_name != 'pull_request' && !cancelled() && !failure() }} + if: ${{ github.event_name != 'pull_request' }} runs-on: ubuntu-latest steps: - name: Clone