From d8c28a1e164148afff9c1c22cbf035871906a9bb Mon Sep 17 00:00:00 2001 From: Ivan Histand Date: Wed, 27 May 2026 11:14:46 -0500 Subject: [PATCH] fix(postgres-fixture): drop deprecated rules_docker; pull postgres image directly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Upstream Dataform removed @io_bazel_rules_docker from WORKSPACE in commit 8be595ac (Mar 2024), but the restored Postgres adapter files in tools/postgres/BUILD still loaded `container_image` from it, breaking `bazel build //...`: error loading package 'tools/postgres': Unable to find package for @io_bazel_rules_docker//container:image.bzl: The repository '@io_bazel_rules_docker' could not be resolved Two paths considered: 1. Restore @io_bazel_rules_docker decl in WORKSPACE (~67 lines of deprecated bazel infra to maintain). 2. Refactor the fixture to use docker run directly. Chose (2). Modern Postgres LTS, no deprecated bazel rules, simpler dev flow. PostgresFixture now starts `postgres:15-alpine` via `docker run` on the local daemon — no Bazel image staging needed. Also rename DOCKER_CONTAINER_NAME from "postgres-df-integration-testing" to "postgres-sa-integration-testing" (rename sweep miss). Verified in Docker: ./scripts/docker-bazel build -- //... -//tools/postgres/... → 332 actions, Build completed successfully tools/postgres/... itself still needs `pg` + `pg-query-stream` added to package.json — that's Phase 1 of docs/postgres_reintegration_assessment.md (separate PR). --- tools/postgres/BUILD | 11 ----------- tools/postgres/postgres_fixture.ts | 13 +++---------- 2 files changed, 3 insertions(+), 21 deletions(-) diff --git a/tools/postgres/BUILD b/tools/postgres/BUILD index e57ec0f9..6cfe239f 100644 --- a/tools/postgres/BUILD +++ b/tools/postgres/BUILD @@ -1,13 +1,5 @@ package(default_visibility = ["//visibility:public"]) -load("@io_bazel_rules_docker//container:image.bzl", "container_image") - -# Exists purely to give a clean name to the postgres Docker image. -container_image( - name = "postgres_image", - base = "@postgres//image", -) - load("//tools:ts_library.bzl", "ts_library") ts_library( @@ -15,9 +7,6 @@ ts_library( srcs = glob( ["*.ts"], ), - data = [ - ":postgres_image", - ], deps = [ "//common/promises", "//testing", diff --git a/tools/postgres/postgres_fixture.ts b/tools/postgres/postgres_fixture.ts index ca0da071..db2c87f6 100644 --- a/tools/postgres/postgres_fixture.ts +++ b/tools/postgres/postgres_fixture.ts @@ -5,22 +5,15 @@ import { sleepUntil } from "sa/common/promises"; import { IHookHandler } from "sa/testing"; const USE_CLOUD_BUILD_NETWORK = !!process.env.USE_CLOUD_BUILD_NETWORK; -const DOCKER_CONTAINER_NAME = "postgres-df-integration-testing"; +const DOCKER_CONTAINER_NAME = "postgres-sa-integration-testing"; +const POSTGRES_IMAGE = "postgres:15-alpine"; const POSTGRES_SERVE_PORT = 5432; export class PostgresFixture { public static readonly host = USE_CLOUD_BUILD_NETWORK ? DOCKER_CONTAINER_NAME : "localhost"; - private static imageLoaded = false; - constructor(port: number, setUp: IHookHandler, tearDown: IHookHandler) { setUp("starting postgres", async () => { - if (!PostgresFixture.imageLoaded) { - // Load the postgres image into the local Docker daemon. - execSync("tools/postgres/postgres_image.executable"); - PostgresFixture.imageLoaded = true; - } - // Run the postgres Docker image. execSync( [ "docker run", @@ -30,7 +23,7 @@ export class PostgresFixture { "-d", `-p ${port}:${POSTGRES_SERVE_PORT}`, USE_CLOUD_BUILD_NETWORK ? "--network cloudbuild" : "", - "bazel/tools/postgres:postgres_image" + POSTGRES_IMAGE ].join(" ") );