Skip to content
This repository was archived by the owner on Mar 23, 2026. It is now read-only.

Commit ff88024

Browse files
committed
suppress warning for the CI env var
1 parent 4801054 commit ff88024

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

localstack-core/localstack/utils/bootstrap.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,9 +516,14 @@ def config_env_vars(cfg: ContainerConfiguration):
516516
for env_var in config.CONFIG_ENV_VARS:
517517
value = os.environ.get(env_var, None)
518518
if value is not None:
519-
if not env_var.startswith("LOCALSTACK_") and env_var not in profile_env:
519+
if (
520+
env_var != "CI"
521+
and not env_var.startswith("LOCALSTACK_")
522+
and env_var not in profile_env
523+
):
520524
# Show a warning here in case we are directly forwarding an environment variable from
521525
# the system env to the container which has not been prefixed with LOCALSTACK_.
526+
# Suppress the warning for the "CI" env var.
522527
# Suppress the warning if the env var was set from the profile.
523528
LOG.warning(
524529
"Non-prefixed environment variable %(env_var)s is forwarded to the LocalStack container! "

tests/bootstrap/test_container_configurators.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,19 @@ def test_container_configurator_no_deprecation_warning_on_prefix(
191191
assert "LOCALSTACK_SERVICES" in container.config.env_vars
192192

193193

194+
def test_container_configurator_no_deprecation_warning_for_CI_env_var(
195+
container_factory, monkeypatch, caplog
196+
):
197+
# set the "CI" env var indicating that we are running in a CI environment
198+
monkeypatch.setenv("CI", "1")
199+
200+
container: Container = container_factory()
201+
configure_container(container)
202+
203+
assert "Non-prefixed environment variable" not in caplog.text
204+
assert "CI" in container.config.env_vars
205+
206+
194207
def test_container_configurator_no_deprecation_warning_on_profile(
195208
container_factory, monkeypatch, caplog, tmp_path
196209
):

0 commit comments

Comments
 (0)