Initialize environment and add E2E tests with formatting#14475
Open
AmelBawa-msft wants to merge 22 commits intofeature/wsl-for-appsfrom
Open
Initialize environment and add E2E tests with formatting#14475AmelBawa-msft wants to merge 22 commits intofeature/wsl-for-appsfrom
AmelBawa-msft wants to merge 22 commits intofeature/wsl-for-appsfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds initial support for passing environment variables from the wslc CLI into container creation/run flows (via -e/--env) and introduces E2E coverage for the new CLI behavior.
Changes:
- Extend
ContainerOptionsto carry environment variables and populate it from CLI args (-e/--env). - Plumb
ContainerOptions.EnvironmentVariablesintoWSLAContainerLauncherduring container creation/run. - Add E2E tests validating
container runenvironment variable propagation.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
test/windows/wslc/e2e/WSLCE2EContainerCreateTests.cpp |
Adds E2E coverage for container run -e/--env and test setup/cleanup env initialization. |
src/windows/wslc/tasks/ContainerTasks.cpp |
Parses -e/--env arguments into ContainerOptions.EnvironmentVariables. |
src/windows/wslc/services/ContainerService.cpp |
Passes EnvironmentVariables into WSLAContainerLauncher for container creation. |
src/windows/wslc/services/ContainerModel.h |
Extends ContainerOptions with an environment variables list. |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds WSLC support for passing environment variables into containers (via -e/--env and --env-file) and validates the behavior through new unit and end-to-end tests.
Changes:
- Extend
container run/createargument definitions to accept repeated-eand--env-file. - Parse/validate env entries (including key-only resolution from host env) and plumb them through
ContainerOptionsintoWSLAContainerLauncher. - Add new unit tests for env parsing and E2E coverage for env/env-file scenarios and precedence.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| test/windows/wslc/e2e/WSLCE2EContainerCreateTests.cpp | Adds E2E coverage for -e and --env-file behavior (including precedence and error cases). |
| test/windows/wslc/WSLCCLIEnvVarParserUnitTests.cpp | New unit tests for env var parsing and env-file parsing behavior. |
| src/windows/wslc/tasks/ContainerTasks.cpp | Parses --env-file and -e args into ContainerOptions.EnvironmentVariables. |
| src/windows/wslc/services/ContainerService.cpp | Passes environment variables to WSLAContainerLauncher during container create/run. |
| src/windows/wslc/services/ContainerModel.h | Adds ContainerOptions.EnvironmentVariables and declares EnvironmentVariable parsing helpers. |
| src/windows/wslc/services/ContainerModel.cpp | Implements env parsing and env-file parsing/validation. |
| src/windows/wslc/commands/ContainerRunCommand.cpp | Updates container run argument definitions to allow repeated env/env-file. |
| src/windows/wslc/commands/ContainerCreateCommand.cpp | Updates container create argument definitions to allow repeated env/env-file. |
OneBlue
reviewed
Mar 21, 2026
…into user/amelbawa/env
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.
Summary of the Pull Request
-eoption inwslc run/create/execPR Checklist
Detailed Description of the Pull Request / Additional comments
Validation Steps Performed