Class TestContainerImages
The public image names and tags live in ONE place —
org/mockserver/test/test-container-images.properties on the classpath,
read here by the Java suites and by .buildkite/scripts/lib/test-images.sh
on the CI host — so the test constants and the pre-pull call sites can no
longer drift out of sync (the drift risk flagged when the two were duplicated).
Registry indirection. When MOCKSERVER_TEST_IMAGE_REGISTRY
(environment variable) or mockserver.test.image.registry (system
property) is set to a registry host, every reference is rewritten to that
registry's pull-through cache repository. CI sets it to the mockserver-build
account's regional ECR host so pulls stay in-region and the upstream registries
(quay.io, Docker Hub, mcr.microsoft.com) are contacted only on a first cache
miss. Left unset — the default for local developers and forks, which have no
ECR access — the public names are used verbatim, so those environments are
completely unaffected.
The rewrite here MUST stay in lockstep with resolve_test_image in
test-images.sh and the ecr_repository_prefix values in
terraform/buildkite-agents/ecr-pull-through-cache.tf. The two CACHED
upstreams and their ECR prefixes, plus the one unsupported passthrough:
quay.io -> quay/<path> quay.io/minio/minio -> <reg>/quay/minio/minio
Docker Hub -> docker-hub/<path> fsouza/fake-gcs-server -> <reg>/docker-hub/fsouza/fake-gcs-server
rabbitmq (official) -> <reg>/docker-hub/library/rabbitmq
mcr.microsoft.com -> UNCHANGED mcr.microsoft.com/.../azurite -> mcr.microsoft.com/azure-storage/azurite
mcr.microsoft.com is not a supported ECR pull-through upstream, so azurite
always pulls direct from Microsoft (passthrough); every other unmapped host is
rejected so a new registry cannot be silently mis-cached.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringmcr.microsoft.com/azure-storage/azurite.static final Stringconfluentinc/cp-kafka.static final Stringeclipse-mosquitto(Docker Hub official image).static final Stringfsouza/fake-gcs-server.static final Stringquay.io/minio/minio.static final Stringrabbitmq(Docker Hub official image).static final StringEnvironment variable that, when set, points image references at an ECR pull-through cache registry host.static final StringSystem-property equivalent ofREGISTRY_ENV(env takes precedence). -
Method Summary
Modifier and TypeMethodDescriptionstatic StringpublicRepository(String key) The PUBLIC repository (host/path without the tag) forkey, for use as the argument to Testcontainers'asCompatibleSubstituteFor(...)so specialised containers (Kafka, RabbitMQ) accept a rewritten image name.static StringThe image reference forkey, rewritten to the configured ECR pull-through cache registry when one is set, otherwise the public name.
-
Field Details
-
REGISTRY_ENV
Environment variable that, when set, points image references at an ECR pull-through cache registry host.- See Also:
-
REGISTRY_PROPERTY
System-property equivalent ofREGISTRY_ENV(env takes precedence).- See Also:
-
MINIO
quay.io/minio/minio. -
FAKE_GCS_SERVER
fsouza/fake-gcs-server. -
AZURITE
mcr.microsoft.com/azure-storage/azurite. -
CP_KAFKA
confluentinc/cp-kafka. -
RABBITMQ
rabbitmq(Docker Hub official image). -
ECLIPSE_MOSQUITTO
eclipse-mosquitto(Docker Hub official image).
-
-
Method Details
-
resolve
The image reference forkey, rewritten to the configured ECR pull-through cache registry when one is set, otherwise the public name.- Throws:
IllegalArgumentException- ifkeyis not in the properties file
-
publicRepository
The PUBLIC repository (host/path without the tag) forkey, for use as the argument to Testcontainers'asCompatibleSubstituteFor(...)so specialised containers (Kafka, RabbitMQ) accept a rewritten image name.
-