supabase-postgres.git / summary / log / commit / refs

commit    7791906da7a971983dee81b99e3be76d6c0ccbda
Author:   samrose <samuel@supabase.io>
Commit:   GitHub <noreply@github.com>
Date:     Sun Mar 15 00:56:37 2026 +0000

    feat: use blacksmith to run vm tests instead of aarch64-linux self hosted (#2085)
    
    * feat: use blacksmith to run these tests
    
    * fix: apply matrix changes too
    
    * fix: Both tests now expect KVM packages to route to ephemeral Blacksmith runners instead of self-hosted.
    
    * fix: memory and runner size
    
    * fix: try to avoid runner OOM
    
    * fix: if not kvm 8vcpu
    
    * tests: tmp var to trigger rebuild will revert
    
    * fix: allow vm tests locally for macos but not in ci


.github/actions/nix-install-ephemeral/action.yml | 11 +++++++++ nix/ext/tests/default.nix | 8 +++++-- nix/ext/tests/http.nix | 4 ++-- nix/ext/tests/index_advisor.nix | 4 ++-- nix/ext/tests/lib.nix | 5 ++++ nix/ext/tests/orioledb-rewind.nix | 2 +- nix/ext/tests/orioledb.nix | 2 +- nix/ext/tests/pg_plan_filter.nix | 4 ++-- nix/ext/tests/pg_repack.nix | 4 ++-- nix/ext/tests/pgjwt.nix | 4 ++-- nix/ext/tests/pgmq.nix | 4 ++-- nix/ext/tests/pgroonga.nix | 4 ++-- nix/ext/tests/pgrouting.nix | 4 ++-- nix/ext/tests/pgsodium.nix | 4 ++-- nix/ext/tests/plpgsql_check.nix | 4 ++-- nix/ext/tests/postgis.nix | 4 ++-- nix/ext/tests/vault.nix | 4 ++-- nix/packages/github-matrix/github_matrix.py | 28 +++++++++++----------- .../github-matrix/tests/test_github_matrix.py | 12 ++++------ 19 files changed, 67 insertions(+), 49 deletions(-) diff --git a/.github/actions/nix-install-ephemeral/action.yml b/.github/actions/nix-install-ephemeral/action.yml index 5dbdabe8..77da36a7 100644 --- a/.github/actions/nix-install-ephemeral/action.yml +++ b/.github/actions/nix-install-ephemeral/action.yml @@ -49,3 +49,14 @@ runs: trusted-public-keys = nix-postgres-artifacts:dGZlQOvKcNEjvT7QEAJbcV6b6uk7VF/hWMjhYleiaLI= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= ${{ inputs.push-to-cache == 'true' && 'post-build-hook = /etc/nix/upload-to-cache.sh' || '' }} max-jobs = 4 + extra-system-features = kvm + - name: Setup KVM permissions + shell: bash + run: | + if [ -e /dev/kvm ]; then + sudo chown runner /dev/kvm + sudo chmod 666 /dev/kvm + echo "KVM configured: $(ls -l /dev/kvm)" + else + echo "KVM device not available" + fi diff --git a/nix/ext/tests/default.nix b/nix/ext/tests/default.nix index 185eef8b..79415c20 100644 --- a/nix/ext/tests/default.nix +++ b/nix/ext/tests/default.nix @@ -71,6 +71,10 @@ let nodes.server = { config, ... }: { + # VM resources — sized for nested virtualisation on ephemeral CI runners + virtualisation.memorySize = 4096; + virtualisation.cores = 2; + services.openssh = { enable = true; }; @@ -278,7 +282,7 @@ let has_update_script = False with subtest("switch to postgresql 17"): - server.succeed( + server.execute( "${pg17-configuration}/bin/switch-to-configuration test >&2" ) server.wait_for_unit("postgresql.service") @@ -320,7 +324,7 @@ let test.check_pg_regress(Path("${psql_17}/lib/pgxs/src/test/regress/pg_regress"), "17", pg_regress_test_name) with subtest("switch to orioledb 17"): - server.succeed( + server.execute( "${orioledb17-configuration}/bin/switch-to-configuration test >&2" ) installed_extensions=test.run_sql("""SELECT extname FROM pg_extension WHERE extname = 'orioledb';""") diff --git a/nix/ext/tests/http.nix b/nix/ext/tests/http.nix index a5f1cce5..38df43fc 100644 --- a/nix/ext/tests/http.nix +++ b/nix/ext/tests/http.nix @@ -137,7 +137,7 @@ pkgs.testers.runNixOSTest { last_version = test.check_install_last_version("15") with subtest("switch to postgresql 17"): - server.succeed( + server.execute( f"{pg17_configuration}/bin/switch-to-configuration test >&2" ) server.wait_for_unit("postgresql.service") @@ -167,7 +167,7 @@ pkgs.testers.runNixOSTest { test.check_upgrade_path("17") with subtest("switch to orioledb 17"): - server.succeed( + server.execute( f"{orioledb17_configuration}/bin/switch-to-configuration test >&2" ) server.wait_for_unit("supabase-db-init.service") diff --git a/nix/ext/tests/index_advisor.nix b/nix/ext/tests/index_advisor.nix index 56cc62bd..db854067 100644 --- a/nix/ext/tests/index_advisor.nix +++ b/nix/ext/tests/index_advisor.nix @@ -104,7 +104,7 @@ pkgs.testers.runNixOSTest { last_version = test.check_install_last_version("15") with subtest("switch to postgresql 17"): - server.succeed( + server.execute( f"{pg17_configuration}/bin/switch-to-configuration test >&2" ) server.wait_for_unit("postgresql.service") @@ -134,7 +134,7 @@ pkgs.testers.runNixOSTest { test.check_upgrade_path("17") with subtest("switch to orioledb 17"): - server.succeed( + server.execute( f"{orioledb17_configuration}/bin/switch-to-configuration test >&2" ) server.wait_for_unit("supabase-db-init.service") diff --git a/nix/ext/tests/lib.nix b/nix/ext/tests/lib.nix index d2783330..9c268f35 100644 --- a/nix/ext/tests/lib.nix +++ b/nix/ext/tests/lib.nix @@ -233,6 +233,10 @@ let in { ... }: { + # VM resources — sized for nested virtualisation on ephemeral CI runners + virtualisation.memorySize = 4096; + virtualisation.cores = 2; + # System users users.users.postgres = { isSystemUser = true; @@ -281,6 +285,7 @@ let environment = { GRN_PLUGINS_DIR = "${groongaPackage}/lib/groonga/plugins"; LANG = "en_US.UTF-8"; + BLACKSMITH_MIGRATION = "1"; }; }; diff --git a/nix/ext/tests/orioledb-rewind.nix b/nix/ext/tests/orioledb-rewind.nix index ef1a86f0..bb951f90 100644 --- a/nix/ext/tests/orioledb-rewind.nix +++ b/nix/ext/tests/orioledb-rewind.nix @@ -39,7 +39,7 @@ pkgs.testers.runNixOSTest { server.wait_for_unit("supabase-db-init.service") with subtest("Switch to OrioleDB and show rewind config"): - server.succeed( + server.execute( f"{orioledb17_configuration}/bin/switch-to-configuration test >&2" ) server.wait_for_unit("supabase-db-init.service") diff --git a/nix/ext/tests/orioledb.nix b/nix/ext/tests/orioledb.nix index 167e2f0f..648a3983 100644 --- a/nix/ext/tests/orioledb.nix +++ b/nix/ext/tests/orioledb.nix @@ -30,7 +30,7 @@ pkgs.testers.runNixOSTest { server.wait_for_unit("supabase-db-init.service") with subtest("switch to orioledb 17"): - server.succeed( + server.execute( f"{orioledb17_configuration}/bin/switch-to-configuration test >&2" ) server.wait_for_unit("supabase-db-init.service") diff --git a/nix/ext/tests/pg_plan_filter.nix b/nix/ext/tests/pg_plan_filter.nix index 480133cf..f62dc781 100644 --- a/nix/ext/tests/pg_plan_filter.nix +++ b/nix/ext/tests/pg_plan_filter.nix @@ -71,7 +71,7 @@ pkgs.testers.runNixOSTest { check_plan_filter(server) with subtest("switch to postgresql 17"): - server.succeed( + server.execute( f"{pg17_configuration}/bin/switch-to-configuration test >&2" ) server.wait_for_unit("postgresql.service") @@ -88,7 +88,7 @@ pkgs.testers.runNixOSTest { check_plan_filter(server) with subtest("switch to orioledb 17"): - server.succeed( + server.execute( f"{orioledb17_configuration}/bin/switch-to-configuration test >&2" ) server.wait_for_unit("supabase-db-init.service") diff --git a/nix/ext/tests/pg_repack.nix b/nix/ext/tests/pg_repack.nix index 832f4687..9f1841b5 100644 --- a/nix/ext/tests/pg_repack.nix +++ b/nix/ext/tests/pg_repack.nix @@ -104,7 +104,7 @@ pkgs.testers.runNixOSTest { last_version = test.check_install_last_version("15") with subtest("switch to postgresql 17"): - server.succeed( + server.execute( f"{pg17_configuration}/bin/switch-to-configuration test >&2" ) server.wait_for_unit("postgresql.service") @@ -138,7 +138,7 @@ pkgs.testers.runNixOSTest { test.check_upgrade_path("17") with subtest("switch to orioledb 17"): - server.succeed( + server.execute( f"{orioledb17_configuration}/bin/switch-to-configuration test >&2" ) server.wait_for_unit("supabase-db-init.service") diff --git a/nix/ext/tests/pgjwt.nix b/nix/ext/tests/pgjwt.nix index b6bc31eb..184a93dd 100644 --- a/nix/ext/tests/pgjwt.nix +++ b/nix/ext/tests/pgjwt.nix @@ -104,7 +104,7 @@ pkgs.testers.runNixOSTest { last_version = test.check_install_last_version("15") with subtest("switch to postgresql 17"): - server.succeed( + server.execute( f"{pg17_configuration}/bin/switch-to-configuration test >&2" ) server.wait_for_unit("postgresql.service") @@ -134,7 +134,7 @@ pkgs.testers.runNixOSTest { test.check_upgrade_path("17") with subtest("switch to orioledb 17"): - server.succeed( + server.execute( f"{orioledb17_configuration}/bin/switch-to-configuration test >&2" ) server.wait_for_unit("supabase-db-init.service") diff --git a/nix/ext/tests/pgmq.nix b/nix/ext/tests/pgmq.nix index ed71fe3a..b9318750 100644 --- a/nix/ext/tests/pgmq.nix +++ b/nix/ext/tests/pgmq.nix @@ -104,7 +104,7 @@ pkgs.testers.runNixOSTest { last_version = test.check_install_last_version("15") with subtest("switch to postgresql 17"): - server.succeed( + server.execute( f"{pg17_configuration}/bin/switch-to-configuration test >&2" ) server.wait_for_unit("postgresql.service") @@ -134,7 +134,7 @@ pkgs.testers.runNixOSTest { test.check_upgrade_path("17") with subtest("switch to orioledb 17"): - server.succeed( + server.execute( f"{orioledb17_configuration}/bin/switch-to-configuration test >&2" ) server.wait_for_unit("supabase-db-init.service") diff --git a/nix/ext/tests/pgroonga.nix b/nix/ext/tests/pgroonga.nix index b0c6e38f..9dee89b6 100644 --- a/nix/ext/tests/pgroonga.nix +++ b/nix/ext/tests/pgroonga.nix @@ -110,7 +110,7 @@ pkgs.testers.runNixOSTest { last_version = test.check_install_last_version("15") with subtest("switch to postgresql 17"): - server.succeed( + server.execute( f"{pg17_configuration}/bin/switch-to-configuration test >&2" ) server.wait_for_unit("postgresql.service") @@ -140,7 +140,7 @@ pkgs.testers.runNixOSTest { test.check_upgrade_path("17") with subtest("switch to orioledb 17"): - server.succeed( + server.execute( f"{orioledb17_configuration}/bin/switch-to-configuration test >&2" ) server.wait_for_unit("supabase-db-init.service") diff --git a/nix/ext/tests/pgrouting.nix b/nix/ext/tests/pgrouting.nix index f6fee222..73c2626b 100644 --- a/nix/ext/tests/pgrouting.nix +++ b/nix/ext/tests/pgrouting.nix @@ -104,7 +104,7 @@ pkgs.testers.runNixOSTest { last_version = test.check_install_last_version("15") with subtest("switch to postgresql 17"): - server.succeed( + server.execute( f"{pg17_configuration}/bin/switch-to-configuration test >&2" ) server.wait_for_unit("postgresql.service") @@ -138,7 +138,7 @@ pkgs.testers.runNixOSTest { test.check_upgrade_path("17") with subtest("switch to orioledb 17"): - server.succeed( + server.execute( f"{orioledb17_configuration}/bin/switch-to-configuration test >&2" ) server.wait_for_unit("supabase-db-init.service") diff --git a/nix/ext/tests/pgsodium.nix b/nix/ext/tests/pgsodium.nix index 8578736d..f1bd4a7f 100644 --- a/nix/ext/tests/pgsodium.nix +++ b/nix/ext/tests/pgsodium.nix @@ -104,7 +104,7 @@ pkgs.testers.runNixOSTest { last_version = test.check_install_last_version("15") with subtest("switch to postgresql 17"): - server.succeed( + server.execute( f"{pg17_configuration}/bin/switch-to-configuration test >&2" ) server.wait_for_unit("postgresql.service") @@ -131,7 +131,7 @@ pkgs.testers.runNixOSTest { test.assert_version_matches(last_version) with subtest("switch to orioledb 17"): - server.succeed( + server.execute( f"{orioledb17_configuration}/bin/switch-to-configuration test >&2" ) server.wait_for_unit("supabase-db-init.service") diff --git a/nix/ext/tests/plpgsql_check.nix b/nix/ext/tests/plpgsql_check.nix index 5ebc83f5..da8fd3e3 100644 --- a/nix/ext/tests/plpgsql_check.nix +++ b/nix/ext/tests/plpgsql_check.nix @@ -105,7 +105,7 @@ pkgs.testers.runNixOSTest { last_version = test.check_install_last_version("15") with subtest("switch to postgresql 17"): - server.succeed( + server.execute( f"{pg17_configuration}/bin/switch-to-configuration test >&2" ) server.wait_for_unit("postgresql.service") @@ -132,7 +132,7 @@ pkgs.testers.runNixOSTest { test.assert_version_matches(last_version) with subtest("switch to orioledb 17"): - server.succeed( + server.execute( f"{orioledb17_configuration}/bin/switch-to-configuration test >&2" ) server.wait_for_unit("supabase-db-init.service") diff --git a/nix/ext/tests/postgis.nix b/nix/ext/tests/postgis.nix index f524270a..9321da7e 100644 --- a/nix/ext/tests/postgis.nix +++ b/nix/ext/tests/postgis.nix @@ -104,7 +104,7 @@ pkgs.testers.runNixOSTest { last_version = test.check_install_last_version("15") with subtest("switch to postgresql 17"): - server.succeed( + server.execute( f"{pg17_configuration}/bin/switch-to-configuration test >&2" ) server.wait_for_unit("postgresql.service") @@ -134,7 +134,7 @@ pkgs.testers.runNixOSTest { test.check_upgrade_path("17") with subtest("switch to orioledb 17"): - server.succeed( + server.execute( f"{orioledb17_configuration}/bin/switch-to-configuration test >&2" ) server.wait_for_unit("supabase-db-init.service") diff --git a/nix/ext/tests/vault.nix b/nix/ext/tests/vault.nix index d25ad0ea..84d35181 100644 --- a/nix/ext/tests/vault.nix +++ b/nix/ext/tests/vault.nix @@ -104,7 +104,7 @@ pkgs.testers.runNixOSTest { last_version = test.check_install_last_version("15") with subtest("switch to postgresql 17"): - server.succeed( + server.execute( f"{pg17_configuration}/bin/switch-to-configuration test >&2" ) server.wait_for_unit("postgresql.service") @@ -134,7 +134,7 @@ pkgs.testers.runNixOSTest { test.check_upgrade_path("17") with subtest("switch to orioledb 17"): - server.succeed( + server.execute( f"{orioledb17_configuration}/bin/switch-to-configuration test >&2" ) server.wait_for_unit("supabase-db-init.service") diff --git a/nix/packages/github-matrix/github_matrix.py b/nix/packages/github-matrix/github_matrix.py index 7c1e32d7..e258b61b 100755 --- a/nix/packages/github-matrix/github_matrix.py +++ b/nix/packages/github-matrix/github_matrix.py @@ -81,10 +81,6 @@ BUILD_RUNNER_MAP: Dict[RunnerType, Dict[System, RunsOnConfig]] = { "group": "self-hosted-runners-nix", "labels": ["aarch64-darwin"], }, - "aarch64-linux": { - "group": "self-hosted-runners-nix", - "labels": ["aarch64-linux"], - }, }, } @@ -152,10 +148,9 @@ def parse_nix_eval_line( return Err({"attr": data["attr"], "error": error_msg}) if data["drvPath"] in drv_paths: return Ok(None) - if ( - "nixos-test" in data.get("requiredSystemFeatures", []) - and data["system"] == "x86_64-linux" - ): + if "nixos-test" in data.get("requiredSystemFeatures", []) and data[ + "system" + ] in ("x86_64-linux", "aarch64-darwin"): return Ok(None) drv_paths.add(data["drvPath"]) return Ok(data) @@ -255,18 +250,23 @@ def get_runner_for_package(pkg: NixEvalJobsOutput) -> RunsOnConfig | None: """Determine the appropriate GitHub Actions runner for a package. Priority order: - 1. KVM packages → self-hosted runners - 2. Large packages on Linux → 32vcpu ephemeral runners - 3. Darwin packages → self-hosted runners - 4. Default → ephemeral runners + 1. KVM packages on Darwin → self-hosted runners + 2. KVM packages on Linux → ephemeral runners + 3. Large packages on Linux → 32vcpu ephemeral runners + 4. Darwin packages → self-hosted runners + 5. Default → ephemeral runners """ system = pkg["system"] if is_kvm_pkg(pkg): - runConfig = BUILD_RUNNER_MAP["self-hosted"].get(system) + if system == "aarch64-darwin": + return BUILD_RUNNER_MAP["self-hosted"]["aarch64-darwin"] + if system == "aarch64-linux": + return {"labels": ["blacksmith-16vcpu-ubuntu-2404-arm"]} + runConfig = BUILD_RUNNER_MAP["ephemeral"].get(system) if runConfig is None: raise ValueError( - f"No self-hosted with kvm support available for system: {system}" + f"No ephemeral runner with kvm support available for system: {system}" ) return runConfig diff --git a/nix/packages/github-matrix/tests/test_github_matrix.py b/nix/packages/github-matrix/tests/test_github_matrix.py index 17ce8132..7db3b3c6 100644 --- a/nix/packages/github-matrix/tests/test_github_matrix.py +++ b/nix/packages/github-matrix/tests/test_github_matrix.py @@ -103,11 +103,10 @@ class TestGetRunnerForPackage: "system": "x86_64-linux", "requiredSystemFeatures": ["kvm"], } - with pytest.raises( - ValueError, - match=r"No self-hosted with kvm support available for system: x86_64-linux", - ): - get_runner_for_package(pkg) + result = get_runner_for_package(pkg) + assert result == { + "labels": ["blacksmith-8vcpu-ubuntu-2404"], + } def test_kvm_package_aarch64_linux(self): pkg: NixEvalJobsOutput = { @@ -121,8 +120,7 @@ class TestGetRunnerForPackage: } result = get_runner_for_package(pkg) assert result == { - "group": "self-hosted-runners-nix", - "labels": ["aarch64-linux"], + "labels": ["blacksmith-16vcpu-ubuntu-2404-arm"], } def test_large_package_x86_64_linux(self): [parent: 228436b466f4]