From b5412dc3b24334f8eb6396b1e37c05a7096eb03e Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Fri, 12 Jun 2026 12:57:36 -0400
Subject: [PATCH v13a 9/9] ci: Move to per-job naming for containers

Previously we only had two types of containers, "ci" for everything but the
CompilerWarnings job and ci_docs that had the tools necessary to build the
docs as part of CompilerWarnings. But that was unnecessarily heavy for several
of the jobs.  As the pull time is a noticeable performance factor, that's not
great.

Instead use containers that are named by their job. Today some of those are
the same, but after this change we can optimize the containers for their jobs
without a problem.

It probably would make sense to allow over-riding CONTAINER_REPO on a
per-repo/org basis, but that seems better done as a separate change.

Discussion: https://postgr.es/m/a2ejn7lfqolutzz7kozalbhy3bixdrujb4buc3pgbtlk4am2ba@wbv6v7riia33
---
 .github/workflows/pg-ci.yml | 32 +++++++++++++++++++++-----------
 1 file changed, 21 insertions(+), 11 deletions(-)

diff --git a/.github/workflows/pg-ci.yml b/.github/workflows/pg-ci.yml
index c737173abe0..4034f76e0a1 100644
--- a/.github/workflows/pg-ci.yml
+++ b/.github/workflows/pg-ci.yml
@@ -108,9 +108,12 @@ env:
 
   # Debian Trixie containers used by all Linux jobs. Built by
   # 'https://github.com/anarazel/pg-vm-images/'.
+  #
+  # The containers are named
+  # ghcr.io/anarazel/pg-vm-images/<branch>/linux_debian_ci/<debian version>/<ci-job>:latest
   CONTAINER_REPO: ghcr.io/anarazel/pg-vm-images/main
-  CONTAINER_LINUX_CI: linux_debian_trixie_ci:latest
-  CONTAINER_LINUX_CI_DOCS: linux_debian_trixie_ci_docs:latest
+  CONTAINER_LINUX_CI_NAME: linux_debian_ci/trixie
+  CONTAINER_TAG: latest
 
   # The full set of OS / job selectors recognized by the `ci-os-only:`
   # commit-message directive parsed in the `setup` job below.
@@ -193,7 +196,7 @@ jobs:
       #
       # To allow over-riding what runners jobs use, we allow setting
       # repository / org level variables influencing that choice on a
-      # per-host-operating-system basis.
+      # per-host-operating-system basis.  See also src/tools/ci/README
       #
       # This also makes it easier to change the version of linux / windows
       # used centrally. We don't just want to use ubuntu-latest, as it's not
@@ -210,8 +213,8 @@ jobs:
       # Re-export workflow-level env vars that other jobs need to reference
       # from contexts (e.g. `jobs.<id>.container.image`) where the `env`
       # context is not available.
-      container_linux_ci: ${{ env.CONTAINER_REPO }}/${{ env.CONTAINER_LINUX_CI }}
-      container_linux_ci_docs: ${{ env.CONTAINER_REPO }}/${{ env.CONTAINER_LINUX_CI_DOCS }}
+      container_linux_ci_base: ${{ env.CONTAINER_REPO }}/${{ env.CONTAINER_LINUX_CI_NAME }}
+      container_tag: ${{ env.CONTAINER_TAG }}
 
     # Can't use the output from above, so repeated verbatim here
     runs-on: ${{ case(vars.pg_ci_runs_on_setup != '', vars.pg_ci_runs_on_setup, 'ubuntu-slim') }}
@@ -277,8 +280,8 @@ jobs:
       needs.setup.outputs.sanitycheck == 'true'
     runs-on: ${{ needs.setup.outputs.runs_on_linux }}
     timeout-minutes: 15
-    container: &linux_ci_container
-      image: ${{ needs.setup.outputs.container_linux_ci }}
+    container:
+      image: ${{ needs.setup.outputs.container_linux_ci_base }}/sanity-check:${{ needs.setup.outputs.container_tag }}
 
       # Options passed to all linux containers. Not all of the jobs need
       # all of them, but it's easier to just define them centrally.
@@ -464,7 +467,9 @@ jobs:
       needs.setup.outputs.linux == 'true' &&
       needs.sanity-check.result != 'failure'
     runs-on: ${{ needs.setup.outputs.runs_on_linux }}
-    container: *linux_ci_container
+    container:
+      image: ${{ needs.setup.outputs.container_linux_ci_base }}/linux-autoconf:${{ needs.setup.outputs.container_tag }}
+      options: *linux_container_options
     timeout-minutes: 60
 
     env: &linux_env
@@ -558,7 +563,9 @@ jobs:
     needs: [setup, sanity-check]
     if: *linux_job_if
     runs-on: ${{ needs.setup.outputs.runs_on_linux }}
-    container: *linux_ci_container
+    container:
+      image: ${{ needs.setup.outputs.container_linux_ci_base }}/linux-meson-32:${{ needs.setup.outputs.container_tag }}
+      options: *linux_container_options
     timeout-minutes: 60
     env: *linux_env
 
@@ -650,7 +657,9 @@ jobs:
     needs: [setup, sanity-check]
     if: *linux_job_if
     runs-on: ${{ needs.setup.outputs.runs_on_linux }}
-    container: *linux_ci_container
+    container:
+      image: ${{ needs.setup.outputs.container_linux_ci_base }}/linux-meson-64:${{ needs.setup.outputs.container_tag }}
+      options: *linux_container_options
     timeout-minutes: 60
     env: *linux_env
 
@@ -1194,7 +1203,8 @@ jobs:
     runs-on: ${{ needs.setup.outputs.runs_on_linux }}
     timeout-minutes: 60
     container:
-      image: ${{ needs.setup.outputs.container_linux_ci_docs }}
+      image: ${{ needs.setup.outputs.container_linux_ci_base }}/compiler-warnings:${{ needs.setup.outputs.container_tag }}
+      options: *linux_container_options
     env:
       # Use larger ccache cache as this job compiles with multiple
       # compilers / flag combinations.
-- 
2.54.0.450.g9ac3f193c0

