Skip to content

Add support for container healthchecks - #41012

Merged
Blue (OneBlue) merged 15 commits into
masterfrom
user/oneblue/health
Jul 9, 2026
Merged

Add support for container healthchecks#41012
Blue (OneBlue) merged 15 commits into
masterfrom
user/oneblue/health

Conversation

@OneBlue

Copy link
Copy Markdown
Collaborator

Summary of the Pull Request

This change adds support for container healthchecks and various related command line arguments

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 July 7, 2026 00:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This pull request adds container healthcheck support to the wslc container workflow end-to-end (CLI parsing/validation → service model → session/container creation → inspect JSON schema), with corresponding unit and e2e coverage.

Changes:

  • Add new wslc CLI healthcheck options (--health-*, --no-healthcheck) with duration parsing/validation and localized error strings.
  • Plumb healthcheck configuration through container creation and surface health state/config via container inspect.
  • Add unit tests and e2e tests validating forwarding, invalid-argument handling, and runtime healthy/unhealthy transitions.

Reviewed changes

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

Show a summary per file
File Description
test/windows/WSLCTests.cpp Adds integration-style tests covering image healthcheck inheritance/override/disable and flag validity updates.
test/windows/wslc/WSLCCLIResourceLimitsParserUnitTests.cpp Adds unit tests for duration parsing/validation used by healthcheck options.
test/windows/wslc/e2e/WSLCE2EHelpers.h Declares a helper to wait for expected container health status in e2e tests.
test/windows/wslc/e2e/WSLCE2EHelpers.cpp Implements WaitForContainerHealth() polling via container inspect.
test/windows/wslc/e2e/WSLCE2EContainerRunTests.cpp Adds e2e coverage for container run health options and health status behavior; updates help text expectations.
test/windows/wslc/e2e/WSLCE2EContainerCreateTests.cpp Adds e2e coverage for container create health options and invalid combinations; updates help text expectations.
test/windows/wslc/CommandLineTestCases.h Adds CLI parsing test cases for new healthcheck arguments for run/create.
src/windows/wslcsession/WSLCContainer.cpp Maps Docker health/config into wslc_schema inspect results; forwards healthcheck config on container create (including disable/conflict).
src/windows/wslc/tasks/ContainerTasks.cpp Plumbs parsed CLI args into the service-layer ContainerOptions model.
src/windows/wslc/services/ContainerService.cpp Applies model healthcheck options onto WSLCContainerLauncher for container creation/run.
src/windows/wslc/services/ContainerModel.h Extends ContainerOptions with healthcheck fields and NoHealthcheck flag.
src/windows/wslc/commands/ContainerRunCommand.cpp Exposes new health-related arguments on container run.
src/windows/wslc/commands/ContainerCreateCommand.cpp Exposes new health-related arguments on container create.
src/windows/wslc/arguments/ArgumentValidation.h Declares duration validation/parsing APIs.
src/windows/wslc/arguments/ArgumentValidation.cpp Implements duration parsing to nanoseconds and argument validation for health options and conflicts.
src/windows/wslc/arguments/ArgumentDefinitions.h Defines new argument types for healthcheck CLI options.
src/windows/service/inc/WSLCShared.idl Adds container flags for healthcheck enable/disable and updates valid-flags mask.
src/windows/service/inc/wslc.idl Extends WSLCContainerOptions with healthcheck fields for session/container creation.
src/windows/inc/wslc_schema.h Extends inspect JSON schema to include health state and healthcheck configuration.
src/windows/inc/docker_schema.h Extends Docker request/inspect schema structs to include healthcheck config and health state parsing.
src/windows/common/WSLCContainerLauncher.h Adds launcher setters and state for healthcheck options and disable flag.
src/windows/common/WSLCContainerLauncher.cpp Populates WSLCContainerOptions health fields and sets the appropriate flags when configured.
localization/strings/en-US/Resources.resw Adds localized CLI descriptions and errors for healthcheck options and invalid duration/conflicts.

@OneBlue
Blue (OneBlue) marked this pull request as ready for review July 7, 2026 23:40
@OneBlue
Blue (OneBlue) requested a review from a team as a code owner July 7, 2026 23:40
Copilot AI review requested due to automatic review settings July 7, 2026 23:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 23 out of 23 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings July 8, 2026 18:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 23 out of 23 changed files in this pull request and generated 2 comments.

Comment thread test/windows/WSLCTests.cpp
Comment thread localization/strings/en-US/Resources.resw Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 8, 2026 20:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 23 out of 23 changed files in this pull request and generated 2 comments.

Comment thread test/windows/WSLCTests.cpp Outdated
Comment thread localization/strings/en-US/Resources.resw Outdated
Copilot AI review requested due to automatic review settings July 8, 2026 20:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 23 out of 23 changed files in this pull request and generated 4 comments.

Comment thread localization/strings/en-US/Resources.resw
Comment thread test/windows/WSLCTests.cpp Outdated
Comment thread test/windows/wslc/e2e/WSLCE2EHelpers.h
Comment thread test/windows/wslc/e2e/WSLCE2EHelpers.cpp
Copilot AI review requested due to automatic review settings July 8, 2026 21:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 23 out of 23 changed files in this pull request and generated 1 comment.

Comment thread src/windows/wslc/arguments/ArgumentValidation.cpp
Copilot AI review requested due to automatic review settings July 9, 2026 00:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 23 out of 23 changed files in this pull request and generated 1 comment.

Comment thread src/windows/wslc/arguments/ArgumentValidation.cpp
Copilot AI review requested due to automatic review settings July 9, 2026 01:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 23 out of 23 changed files in this pull request and generated 4 comments.

Comment thread localization/strings/en-US/Resources.resw
Comment thread test/windows/wslc/e2e/WSLCE2EContainerRunTests.cpp
Comment thread test/windows/wslc/e2e/WSLCE2EContainerCreateTests.cpp
Comment thread src/windows/wslc/arguments/ArgumentValidation.cpp
@OneBlue
Blue (OneBlue) merged commit b3decbd into master Jul 9, 2026
12 checks passed
@OneBlue
Blue (OneBlue) deleted the user/oneblue/health branch July 9, 2026 22:01

@francojuliofranco14-bit francojuliofranco14-bit left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

A065MUBS3AYB3
Unkonw flashing

// A health check that hangs past its timeout should be treated as a failure and drive the
// container to the "unhealthy" state. Docker reports a timed-out probe with exit code -1.
auto result = RunWslc(std::format(
LR"(container run -d --health-cmd "sleep 30" --health-interval 1s --health-timeout 1s --health-retries 1 --name {} {} sleep infinity)",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Unkonw flashing

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