Skip to content

Fail product tests on unpinned container images - #31005

Open
findepi wants to merge 1 commit into
trinodb:masterfrom
findepi:findepi/product-test-require-pinned-images
Open

Fail product tests on unpinned container images#31005
findepi wants to merge 1 commit into
trinodb:masterfrom
findepi:findepi/product-test-require-pinned-images

Conversation

@findepi

@findepi findepi commented Sep 4, 2026

Copy link
Copy Markdown
Member

Product-test environments pull container images by name, and it is easy to reference one without a version tag or with an explicit ":latest". Both resolve to a mutable image: the run then depends on whatever ":latest" happens to point at, which is non-reproducible and can silently pick up an incompatible image, or one that no longer exists for images published under versioned tags only. The mistake is invisible in review because the code still compiles and usually still runs locally.

Enforce the invariant instead of relying on reviewers. Testcontainers invokes a configured ImageNameSubstitutor for every image it resolves, so a single substitutor registered via ServiceLoader validates every container started by a product test - the images defined here as well as those from Testcontainers modules - without touching each call site. RequireVersionedImageSubstitutor rejects any image whose version part is "latest" (both untagged references and an explicit ":latest" map to it), while explicit tags and digests pass through. The service registration lives only in trino-product-tests test resources, so the check is scoped to product tests.

As a side effect this enforces the existing convention that the Trino image must be overridden to the locally built image: its default is trinodb/trino:latest, so forgetting to set trino.product-tests.image now fails fast with a clear message rather than silently pulling a stale published image.

Also assert docker.images.version is a pinned version at its source in TestingProperties, which feeds every ghcr.io/trinodb/testing image.

@findepi
findepi requested review from dain and wendigo September 4, 2026 14:27
@findepi
findepi removed request for dain and wendigo September 4, 2026 20:31
Product-test environments pull container images by name, and it is easy to
reference one without a version tag or with an explicit ":latest". Both
resolve to a mutable image: the run then depends on whatever ":latest"
happens to point at, which is non-reproducible and can silently pick up an
incompatible image, or one that no longer exists for images published under
versioned tags only. The mistake is invisible in review because the code
still compiles and usually still runs locally.

Enforce the invariant instead of relying on reviewers. Testcontainers
invokes a configured ImageNameSubstitutor for every image it resolves, so a
single substitutor registered via ServiceLoader validates every container
started by a product test - the images defined here as well as those from
Testcontainers modules - without touching each call site.
RequireVersionedImageSubstitutor rejects any image whose version part is
"latest" (both untagged references and an explicit ":latest" map to it),
while explicit tags and digests pass through. The service registration lives
only in trino-product-tests test resources, so the check is scoped to
product tests.

As a side effect this enforces the existing convention that the Trino image
must be overridden to the locally built image: its default is
trinodb/trino:latest, so forgetting to set trino.product-tests.image now
fails fast with a clear message rather than silently pulling a stale
published image. TestTrinoProductTestContainer exercises the container
builder rather than the code under development and relied on that default,
so it now pins the last released version instead.

Also assert docker.images.version is a pinned version at its source in
TestingProperties, which feeds every ghcr.io/trinodb/testing image.
@findepi
findepi force-pushed the findepi/product-test-require-pinned-images branch from 33c96e9 to 138ac0d Compare September 4, 2026 20:44
@findepi
findepi requested review from dain, ebyhr and wendigo September 4, 2026 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

1 participant