Fail product tests on unpinned container images - #31005
Open
findepi wants to merge 1 commit into
Open
Conversation
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
force-pushed
the
findepi/product-test-require-pinned-images
branch
from
September 4, 2026 20:44
33c96e9 to
138ac0d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.