Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion utils/localstack_extensions/utils/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,16 @@ def __init__(
http2_ports: list[int] | None = None,
tcp_ports: list[int] | None = None,
):
self.image_name = image_name
from localstack.constants import ENV_PRO_ACTIVATED

pro_activated = is_env_true(ENV_PRO_ACTIVATED)
Copy link
Copy Markdown
Member

@whummer whummer Feb 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than checking the environment variable here, I think it would be better to add a try/except around the import (this will decouple us a bit more from the env variable, and leave the logic of gated code imports to higher abstraction levels 👍 ).


Update: briefly chatted with Pat about this offline, we'll merge this as-is for now, and then look into further CI coverage of this feature under different plans (free plan, enterprise plan, etc) post image consolidation launch.

Also, build errors in CI are unrelated to this branch - will fix those separately as part of #130 👍


if pro_activated:
from localstack.pro.core.utils.container.registry_strategies import CustomizableRegistryStrategy
self.image_name = CustomizableRegistryStrategy().resolve(image_name)
else:
self.image_name = image_name

if not container_ports:
raise ValueError("container_ports is required")
self.container_ports = container_ports
Expand Down
2 changes: 1 addition & 1 deletion utils/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "localstack-extensions-utils"
version = "0.1.0"
version = "0.1.1"
description = "Utility library for LocalStack Extensions"
readme = {file = "README.md", content-type = "text/markdown; charset=UTF-8"}
requires-python = ">=3.10"
Expand Down
8 changes: 6 additions & 2 deletions wiremock/localstack_wiremock/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
ENV_WIREMOCK_API_TOKEN = "WIREMOCK_API_TOKEN"
# Host path to directory containing .wiremock/ (required for runner mode)
ENV_WIREMOCK_CONFIG_DIR = "WIREMOCK_CONFIG_DIR"
# Override the OSS image (default: wiremock/wiremock); accepts full ref with optional tag
ENV_WIREMOCK_IMAGE = "WIREMOCK_IMAGE"
# Override the runner image (default: wiremock/wiremock-runner); accepts full ref with optional tag
ENV_WIREMOCK_IMAGE_RUNNER = "WIREMOCK_IMAGE_RUNNER"

SERVICE_PORT = 8080 # Mock API port
ADMIN_PORT = 9999 # Admin interface port (runner mode)
Expand All @@ -29,7 +33,7 @@ class WireMockExtension(ProxiedDockerContainerExtension):

def __init__(self):
env_vars = {}
image_name = self.DOCKER_IMAGE
image_name = os.getenv(ENV_WIREMOCK_IMAGE) or self.DOCKER_IMAGE
volumes = None
container_ports = [SERVICE_PORT]
health_check_path = "/__admin/health"
Expand All @@ -41,7 +45,7 @@ def __init__(self):
env_vars["WMC_ADMIN_PORT"] = str(ADMIN_PORT)
env_vars["WMC_API_TOKEN"] = api_token
env_vars["WMC_RUNNER_ENABLED"] = "true"
image_name = self.DOCKER_IMAGE_RUNNER
image_name = os.getenv(ENV_WIREMOCK_IMAGE_RUNNER) or self.DOCKER_IMAGE_RUNNER
container_ports = [SERVICE_PORT, ADMIN_PORT]
health_check_path = "/__/health"
health_check_retries = 90
Expand Down