CLI: Add label option in wslc run/create#40275
Open
AmelBawa-msft wants to merge 6 commits intofeature/wsl-for-appsfrom
Open
CLI: Add label option in wslc run/create#40275AmelBawa-msft wants to merge 6 commits intofeature/wsl-for-appsfrom
AmelBawa-msft wants to merge 6 commits intofeature/wsl-for-appsfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds first-class --label support to WSLC container run/create, including parsing/validation and surfacing labels via container inspect, with corresponding unit + E2E coverage.
Changes:
- Add
--label(-l) argument support towslc container runandwslc container create, wiring through to container creation. - Extend
InspectContainerschema/output to include container labels (excluding internal metadata labels). - Add unit tests for label/driver-opt parsing and E2E tests validating labels round-trip via
container inspect.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/windows/wslc/e2e/WSLCE2EVolumeCreateTests.cpp | Updates expected help text to reflect -l,--label and new description. |
| test/windows/wslc/e2e/WSLCE2EContainerRunTests.cpp | Adds E2E test for labels on container run and updates help expectation. |
| test/windows/wslc/e2e/WSLCE2EContainerCreateTests.cpp | Adds E2E test for labels on container create and updates help expectation. |
| test/windows/wslc/WSLCCLIOptionsParserUnitTests.cpp | New unit tests for driver option parsing (DriverOption::Parse). |
| test/windows/wslc/WSLCCLILabelParserUnitTests.cpp | New unit tests for label parsing/validation (Label::Parse). |
| src/windows/wslcsession/WSLCContainer.cpp | Populates InspectContainer.Labels from stored labels (filtering internal metadata). |
| src/windows/wslc/tasks/VolumeTasks.cpp | Switches volume opt/label parsing to DriverOption::Parse / Label::Parse. |
| src/windows/wslc/tasks/ContainerTasks.cpp | Parses --label args into ContainerOptions.Labels. |
| src/windows/wslc/services/VolumeModel.h | Introduces Label and DriverOption parsing helpers + stores labels/opts as key/value pairs. |
| src/windows/wslc/services/VolumeModel.cpp | Implements Label::Parse and DriverOption::Parse (incl. empty-key validation for labels). |
| src/windows/wslc/services/ContainerService.cpp | Passes labels through to WSLCContainerLauncher during container creation. |
| src/windows/wslc/services/ContainerModel.h | Adds Labels to ContainerOptions. |
| src/windows/wslc/commands/ContainerRunCommand.cpp | Exposes ArgType::Label for container run. |
| src/windows/wslc/commands/ContainerCreateCommand.cpp | Exposes ArgType::Label for container create. |
| src/windows/wslc/arguments/ArgumentDefinitions.h | Defines label as -l,--label and switches description to localized string. |
| src/windows/inc/wslc_schema.h | Adds Labels to InspectContainer JSON schema/serialization. |
| localization/strings/en-US/Resources.resw | Adds localized strings for label arg description and empty-key error. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
dkbennett
approved these changes
Apr 23, 2026
OneBlue
reviewed
Apr 23, 2026
|
|
||
| struct Label | ||
| { | ||
| std::string Key() const |
Collaborator
There was a problem hiding this comment.
Could we use the same type for both of those ? Something like KeyValuePair ?
Collaborator
There was a problem hiding this comment.
Or alternatively we could use std::pair for this (this would have the benefit of removing the copy that Key() and Value() do on return in the current implementation)
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
PR Checklist
Detailed Description of the Pull Request / Additional comments
Validation Steps Performed