Skip to content

CLI: Add label option in wslc run/create#40275

Open
AmelBawa-msft wants to merge 6 commits intofeature/wsl-for-appsfrom
user/amelbawa/label
Open

CLI: Add label option in wslc run/create#40275
AmelBawa-msft wants to merge 6 commits intofeature/wsl-for-appsfrom
user/amelbawa/label

Conversation

@AmelBawa-msft
Copy link
Copy Markdown

Summary of the Pull Request

  • Add label option in wslc run/create

PR Checklist

  • Closes: Link to issue #xxx
  • Communication: I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected
  • Tests: Added/updated if needed and all pass
  • Localization: All end user facing strings can be localized
  • Dev docs: Added/updated if needed
  • Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx

Detailed Description of the Pull Request / Additional comments

Validation Steps Performed

Copilot AI review requested due to automatic review settings April 22, 2026 19:45
@AmelBawa-msft AmelBawa-msft requested a review from a team as a code owner April 22, 2026 19:45
@AmelBawa-msft AmelBawa-msft marked this pull request as draft April 22, 2026 19:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 to wslc container run and wslc container create, wiring through to container creation.
  • Extend InspectContainer schema/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.

Comment thread src/windows/wslcsession/WSLCContainer.cpp Outdated
Comment thread src/windows/wslc/tasks/ContainerTasks.cpp
AmelBawa-msft and others added 2 commits April 22, 2026 14:03
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 23, 2026 16:51
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 17 out of 17 changed files in this pull request and generated no new comments.

@AmelBawa-msft AmelBawa-msft marked this pull request as ready for review April 23, 2026 19:34

struct Label
{
std::string Key() const
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Could we use the same type for both of those ? Something like KeyValuePair ?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants