Thanks to visit codestin.com
Credit goes to github.com

Skip to content

avoid setting LOCALSTACK_CLI in the container #9223

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 25, 2023

Conversation

alexrashed
Copy link
Member

Motivation

#7906 introduced the LOCALSTACK_CLI env variable, which is only used as a workaround to indicate that we are currently in a CLI environment (other than an actual runtime environment).

With #8307, we removed the install-dependency on localstack_client.
We added a global env prefix LOCALSTACK_. All environment variables with this prefix will be added to the container (no matter if they are listed in the CONFIG_ENV_VARS global variable). The intention for that is that we have a simple way of adding new variables which should be forwarded to a container without maintaining this global list.

Unfortunately, since #8307 is merged, we set the LOCALSTACK_CLI also in LocalStack containers started by the CLI, which shouldn't be set.

This PR fixes this.

Changes

  • Explicitly exclude LOCALSTACK_CLI from the CONFIG_ENV_VARS when populating it from the current environment.

Testing

Unfortunately, this is really hard to test, since it's a change in config.py. The LOCALSTACK_CLI env var is only set later for our tests in the conftest.py, which is why this change isn't even considered in our tests (the tests never even adds the LOCALSTACK_CLI, since it's set after the CONFIG_ENV_VARS are populated).
I'm happy for any suggestions on how to properly test this...

@alexrashed alexrashed added the semver: patch Non-breaking changes which can be included in patch releases label Sep 25, 2023
@alexrashed alexrashed added this to the 2.3 milestone Sep 25, 2023
@alexrashed alexrashed self-assigned this Sep 25, 2023
@alexrashed alexrashed requested a review from thrau as a code owner September 25, 2023 15:56
Copy link
Member

@thrau thrau left a comment

Choose a reason for hiding this comment

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

LGTM! thanks for fixing

@coveralls
Copy link

Coverage Status

coverage: 82.997% (-0.03%) from 83.022% when pulling 44564b4 on fix-localstack-cli-forwarding into 402450d on master.

@github-actions
Copy link

LocalStack Community integration with Pro

       2 files         2 suites   1h 22m 7s ⏱️
2 220 tests 1 723 ✔️ 497 💤 0
2 221 runs  1 723 ✔️ 498 💤 0

Results for commit 44564b4.

@alexrashed alexrashed merged commit 90cd083 into master Sep 25, 2023
@alexrashed alexrashed deleted the fix-localstack-cli-forwarding branch September 25, 2023 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver: patch Non-breaking changes which can be included in patch releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants