Skip to content

[release/13.4] Validate Helm CLI version (>= 4.2.0) before Kubernetes deploy - #17542

Merged
David Fowler (davidfowl) merged 7 commits into
release/13.4from
backport/pr-17491-to-release/13.4
May 27, 2026
Merged

David Fowler (davidfowl) merged 7 commits into
release/13.4from
backport/pr-17491-to-release/13.4

Conversation

@aspire-repo-bot

Copy link
Copy Markdown
Contributor

Backport of #17491 to release/13.4

/cc Mitch Denny (@mitchdenny)

Customer Impact

Testing

Risk

Regression?

Mitch Denny (mitchdenny) and others added 7 commits May 27, 2026 14:23
Aspire's Kubernetes deployment pipeline shells out to 'helm upgrade --install'
for the main application chart and for any AddHelmChart(...) resources on a
KubernetesEnvironmentResource. Previously we only checked that 'helm' was on
PATH; we never asserted the installed Helm version was new enough for the
flags and behaviors we depend on (e.g. '--server-side=true --force-conflicts'
in the Helm 4 form). Missing or older Helm produced confusing low-level
errors like 'unknown flag: --force-conflicts', 'Flag --force has been
deprecated', or raw process-spawn failures.

Changes:

* Add internal HelmVersionValidator that runs 'helm version --short --client',
  parses the SemVer, and asserts a minimum of Helm 4.2.0. Throws a clear
  actionable InvalidOperationException (detected vs required + link to
  https://helm.sh/docs/intro/install/) when the version is too old,
  unparseable, or the command fails.
* Wire the validator into the existing check-helm-prereqs-{env} pipeline
  step in HelmDeploymentEngine. One check per environment covers both the
  main chart deploy and AddHelmChart(...) flows since they all DependsOn this
  step.
* Update the 'Helm CLI not found' message to also mention the minimum
  version requirement.
* Remove the now-redundant ad-hoc 'helm version --short' probe at the top of
  HelmDeployAsync (the prereq step covers it with a much better error).
* Promote FakeHelmRunner to a file-scoped test helper that emits canned
  'helm version' stdout (defaults to v4.2.0+gfa15ec0) and supports a
  separate VersionExitCode, so any test exercising the deploy path
  automatically passes the prereq check.
* Add HelmVersionValidatorTests covering: SemVer parsing of v3/v4/v5 outputs
  with and without '+gitsha' build metadata, rejection of unparseable
  output, threshold behavior for too-old versions (v4.1.0, v4.0.0, v3.18.0,
  v3.14.4), and that error messages include the detected version, the
  required version, and the install docs URL.
* Document the Helm 4.2.0+ requirement in the Aspire.Hosting.Kubernetes and
  Aspire.Hosting.Azure.Kubernetes READMEs.

Fixes #16977

Co-authored-by: Copilot <[email protected]>
The validator was invoking 'helm version --short --client', but the
--client flag was removed in Helm 4 (it existed in Helm 2 for the
real client/server split, was kept as a no-op in Helm 3, and is
unknown in Helm 4). Since this validator's purpose is to enforce
Helm 4.2.0 or later, passing --client guarantees a failure against
the very minimum version we require, surfacing the exact kind of
confusing prereq error this step exists to prevent.

Caught by dogfood testing of PR #17491 against a local Helm 4.2.0
install, which produced:

  Step 'check-helm-prereqs-k8s' failed: 'helm version --short --client'
  failed (Error: unknown flag: --client). Aspire requires Helm 4.2.0
  or later.

Switch to 'helm version --short', which produces identical output
shape (e.g. v4.2.0+gfa15ec0) on Helm 3 and Helm 4. Add a regression
test that records the arguments passed to the runner and asserts
--client is never included.

Co-authored-by: Copilot <[email protected]>
Three review items from the automated PR reviewer:

1. Gate destroy/uninstall on the same Helm prereq check as deploy.
   Both 'destroy-helm-{env}' and 'helm-uninstall-{env}' invoke 'helm
   uninstall', so a missing or too-old Helm would surface as a raw
   process-spawn / unknown-flag error during teardown instead of the
   actionable validator message. Add a 'DependsOn(check-helm-prereqs-
   {env})' on both, and add a regression test that asserts the
   dependency edge exists.

2. Fix the misleading comment above HelmVersionRegex. The regex is
   intentionally unanchored so we tolerate banner/shim lines that
   some shells, oh-my-zsh plugins, or asdf-style shims can prepend
   to the version output. Update the comment to describe that
   intent instead of claiming a start anchor that isn't there.

3. Shorten the Helm prerequisite bullets in both Kubernetes README
   files. Keep the bullet to the requirement itself and move the
   'why we validate up front' narrative into a short paragraph
   below, matching the scannable style of the other hosting READMEs.

Co-authored-by: Copilot <[email protected]>
The 11 DeployK8s* CLI E2E tests failed on commit d03916c because the
container install scripts default HELM_VERSION to v3.17.3 — below the
new HelmVersionValidator.MinimumHelmVersion (v4.2.0) that the
check-helm-prereqs-{env} pipeline step now enforces.

Centralize the version constants in a new
tests/Aspire.Cli.EndToEnd.Tests/Helpers/KubernetesE2EVersions.cs so the
default lives in one place (and points at the validator's documented
minimum), then bump HelmVersion default v3.17.3 -> v4.2.0 (used by every
DeployK8s* test and by the quarantined KubernetesPublishTests).

HELM_VERSION / KIND_VERSION / KUBECTL_VERSION env-var overrides are
preserved so CI can still bump to a newer point release without a
code change.

The AKS deployment workflow (deployment-tests.yml) still pins
azure/setup-helm to v4.1.4 and needs the same bump to v4.2.0 to avoid
breaking AKS scenarios under the new validator; that workflow file edit
will land in a separate push that has 'workflow' OAuth scope.

Co-authored-by: Copilot <[email protected]>
Match Aspire.Hosting.Kubernetes' new minimum supported Helm version
(HelmVersionValidator.MinimumHelmVersion). The check-helm-prereqs-{env}
pipeline step now fails fast on older Helm CLIs, so leaving the AKS
deployment workflow pinned to v4.1.4 would break every AKS deployment
scenario. Also refresh the surrounding rationale comment, which still
referred to the historical v3.18 server-side narrative.

Co-authored-by: Copilot <[email protected]>
Address self-review follow-ups on PR #17491:

- Per-chart `helm-uninstall-{name}` step (AddHelmChart(...).WithDestroy())
  now depends on `check-helm-prereqs-{env}`. Previously only the env-level
  destroy/uninstall steps were gated, so chart teardown could still hit the
  cryptic spawn / unknown-flag error the validator exists to prevent.
- Drop the standalone PathLookupHelper probe from the prereq step. The
  validator already wraps spawn failures with the same actionable hint, and
  routing everything through IHelmRunner lets tests inject a fake without
  needing real Helm on PATH (fixes 3 pre-existing K8s test failures in
  environments without helm installed).
- Refresh validator catch comment + error wording accordingly.
- Drop stale `--client` mention in FakeHelmRunner comment.
- Add regression test PerChartHelmUninstallStep_DependsOnCheckHelmPrereqs.

Co-authored-by: Copilot <[email protected]>
Copilot AI review requested due to automatic review settings May 27, 2026 14:23

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 17542

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 17542"

@github-actions

Copy link
Copy Markdown
Contributor

❌ CLI E2E Tests failed — 106 passed, 1 failed, 2 unknown (commit bbb224a)

Failed Tests

View all recordings
Status Test Recording
✅ AddPackageInteractiveWhileAppHostRunningDetached ✅ ▶️ View recording
✅ AddPackageWhileAppHostRunningDetached ✅ ▶️ View recording
✅ AgentCommands_AllHelpOutputs_AreCorrect ✅ ▶️ View recording
✅ AgentInitCommand_DefaultSelection_InstallsDefaultSkills ✅ ▶️ View recording
✅ AgentInitCommand_MigratesDeprecatedConfig ✅ ▶️ View recording
✅ AgentMcpListStructuredLogsReturnsLogsFromStarterApp ✅ ▶️ View recording
✅ AgentMcpListStructuredLogsReturnsLogsFromStarterApp_DevLocalhost ✅ ▶️ View recording
✅ AgentMcpListStructuredLogsReturnsLogsFromStarterApp_Isolated ✅ ▶️ View recording
✅ AllPublishMethodsBuildDockerImages ✅ ▶️ View recording
✅ AspireAddAndStartWorkAgainstLegacyAppHostTs ✅ ▶️ View recording
✅ AspireAddPackageVersionToDirectoryPackagesProps ✅ ▶️ View recording
✅ AspireInitSingleFileAppHostRunsViaDotnetRunAppHost ✅ ▶️ View recording
✅ AspireInitWithExistingAppHostDirRecreatesMissingNuGetConfigAndPreservesFiles ✅ ▶️ View recording
❔ AspireInitWithSolutionFileGeneratesAppHostThatBuildsAgainstChannelHive ❔ ▶️ View recording
✅ AspireStartUpdatesStaleTypeScriptAppHostPath ✅ ▶️ View recording
✅ AspireUpdateRemovesAppHostPackageVersionFromDirectoryPackagesProps ✅ ▶️ View recording
✅ AspireUpdateRemovesOrphanAppHostPackageVersionWhenSdkAlreadyCurrent ✅ ▶️ View recording
✅ Banner_DisplayedOnFirstRun ✅ ▶️ View recording
✅ Banner_DisplayedWithExplicitFlag ✅ ▶️ View recording
✅ Banner_NotDisplayedWithNoLogoFlag ✅ ▶️ View recording
✅ CertificatesClean_RemovesCertificates ✅ ▶️ View recording
✅ CertificatesTrust_WithNoCert_CreatesAndTrustsCertificate ✅ ▶️ View recording
✅ CertificatesTrust_WithUntrustedCert_TrustsCertificate ✅ ▶️ View recording
✅ ConfigSetGet_CreatesNestedJsonFormat ✅ ▶️ View recording
✅ CreateAndRunAspireStarterProject ✅ ▶️ View recording
✅ CreateAndRunAspireStarterProjectWithBundle ✅ ▶️ View recording
✅ CreateAndRunEmptyAppHostProject ✅ ▶️ View recording
✅ CreateAndRunJavaEmptyAppHostProject ✅ ▶️ View recording
✅ CreateAndRunJsReactProject ✅ ▶️ View recording
✅ CreateAndRunPythonReactProject ✅ ▶️ View recording
✅ CreateAndRunTypeScriptEmptyAppHostProject ✅ ▶️ View recording
✅ CreateAndRunTypeScriptStarterProject ✅ ▶️ View recording
✅ CreateJavaAppHostWithViteApp ✅ ▶️ View recording
✅ CreateTypeScriptAppHostWithViteApp_AllowsGuestAppPackageManagerToDiffer ✅ ▶️ View recording
✅ CreateTypeScriptAppHostWithViteApp_UsesConfiguredToolchain ✅ ▶️ View recording
✅ DashboardRunWithAgentMcpListTracesReturnsNoTraces ✅ ▶️ View recording
✅ DashboardRunWithAgentMcpListTracesReturnsNoTraces_DevLocalhost ✅ ▶️ View recording
✅ DashboardRunWithOtelTracesReturnsNoTraces ✅ ▶️ View recording
✅ DashboardRunWithOtelTracesReturnsNoTraces_DevLocalhost ✅ ▶️ View recording
✅ DeployK8sBasicApiService ✅ ▶️ View recording
✅ DeployK8sWithExternalHelmChart ✅ ▶️ View recording
✅ DeployK8sWithGarnet ✅ ▶️ View recording
✅ DeployK8sWithMongoDB ✅ ▶️ View recording
✅ DeployK8sWithMySql ✅ ▶️ View recording
✅ DeployK8sWithPostgres ✅ ▶️ View recording
✅ DeployK8sWithRabbitMQ ✅ ▶️ View recording
✅ DeployK8sWithRedis ✅ ▶️ View recording
❌ DeployK8sWithSqlServer ❌ ▶️ View failure recording
✅ DeployK8sWithValkey ✅ ▶️ View recording
✅ DeployTypeScriptAppToKubernetes ✅ ▶️ View recording
✅ DescribeCommandResolvesReplicaNames ✅ ▶️ View recording
✅ DescribeCommandShowsRunningResources ✅ ▶️ View recording
✅ DetachFormatJsonProducesValidJson ✅ ▶️ View recording
✅ DetachFormatJsonProducesValidJsonWhenRestartingExistingInstance ✅ ▶️ View recording
✅ DoListStepsShowsPipelineSteps ✅ ▶️ View recording
✅ DocsCommand_RendersInteractiveMarkdownFromLocalSource ✅ ▶️ View recording
✅ DoctorCommand_DetectsDeprecatedAgentConfig ✅ ▶️ View recording
✅ DoctorCommand_TypeScriptAppHostReportsMissingConfiguredToolchain ✅ ▶️ View recording
✅ DoctorCommand_WithSslCertDir_ShowsTrusted ✅ ▶️ View recording
✅ DoctorCommand_WithoutSslCertDir_ShowsPartiallyTrusted ✅ ▶️ View recording
✅ GatewayWithoutExternalEndpoint_FailsPublishWithGuidance ✅ ▶️ View recording
✅ GeneratedAspireDevScript_StartsWatchMode_WithConfiguredToolchain ✅ ▶️ View recording
✅ GlobalMigration_HandlesCommentsAndTrailingCommas ✅ ▶️ View recording
✅ GlobalMigration_HandlesMalformedLegacyJson ✅ ▶️ View recording
✅ GlobalMigration_PreservesAllValueTypes ✅ ▶️ View recording
✅ GlobalMigration_SkipsWhenNewConfigExists ✅ ▶️ View recording
✅ GlobalSettings_MigratedFromLegacyFormat ✅ ▶️ View recording
✅ IngressWithoutExternalEndpoint_FailsPublishWithGuidance ✅ ▶️ View recording
✅ InitTypeScriptAppHost_AugmentsExistingViteRepoInWorkspaceSubdirectory ✅ ▶️ View recording
✅ InteractiveCSharpInitCreatesExpectedFiles ✅ ▶️ View recording
✅ InvalidAppHostPathWithComments_IsHealedOnRun ✅ ▶️ View recording
✅ JavaScriptHostingApisRunFromTypeScriptAppHost ✅ ▶️ View recording
✅ LatestCliCanStartStableChannelAppHost ✅ ▶️ View recording
✅ LatestCliCanStartStableChannelTypeScriptAppHost ✅ ▶️ View recording
✅ LegacySettingsMigration_AdjustsRelativeAppHostPath ✅ ▶️ View recording
✅ LogsCommandShowsResourceLogs ✅ ▶️ View recording
✅ OtelLogsReturnsStructuredLogsFromStarterApp ✅ ▶️ View recording
✅ OtelLogsReturnsStructuredLogsFromStarterAppIsolated ✅ ▶️ View recording
✅ PsCommandListsRunningAppHost ✅ ▶️ View recording
✅ PsFormatJsonOutputsOnlyJsonToStdout ✅ ▶️ View recording
✅ PublishJavaScriptPatternsGeneratesExpectedDockerComposeArtifacts ✅ ▶️ View recording
✅ PublishWithConfigureEnvFileUpdatesEnvOutput ✅ ▶️ View recording
✅ PublishWithDockerComposeServiceCallbackSucceeds ✅ ▶️ View recording
✅ PublishWithoutOutputPathUsesAppHostDirectoryDefault ✅ ▶️ View recording
✅ ResourceCommand_FailedExecution_DisplaysAppHostLogPathAndLogContainsEntries ✅ ▶️ View recording
✅ ResourceCommand_SetAndDeleteParameterUpdatesDescribeOutput ✅ ▶️ View recording
✅ RestoreGeneratesSdkFiles ✅ ▶️ View recording
✅ RestoreGeneratesSdkFiles_WithConfiguredToolchain ✅ ▶️ View recording
✅ RestoreRefreshesGeneratedSdkAfterAddingIntegration ✅ ▶️ View recording
✅ RestoreSupportsConfigOnlyHelperPackageAndCrossPackageTypes ✅ ▶️ View recording
✅ RunFromParentDirectory_UsesExistingConfigNearAppHost ✅ ▶️ View recording
✅ RunReportsSyntaxErrorsForDotNetAppHost ✅ ▶️ View recording
✅ RunReportsSyntaxErrorsForTypeScriptAppHost ✅ ▶️ View recording
✅ SecretCrudOnDotNetAppHost ✅ ▶️ View recording
✅ SecretCrudOnTypeScriptAppHost ✅ ▶️ View recording
✅ StagingChannel_ConfigureAndVerifySettings_ThenSwitchChannels ✅ ▶️ View recording
✅ StartAndWaitForTypeScriptSqlServerAppHostWithNativeAssets ✅ ▶️ View recording
✅ StartReportsSyntaxErrorsForDotNetAppHost ✅ ▶️ View recording
✅ StartReportsSyntaxErrorsForTypeScriptAppHost ✅ ▶️ View recording
✅ StopAllAppHostsFromAppHostDirectory ✅ ▶️ View recording
✅ StopJavaPolyglotAppHostUsingApphostDirectory ✅ ▶️ View recording
✅ StopNonInteractiveSingleAppHost ✅ ▶️ View recording
✅ StopTypeScriptPolyglotAppHostUsingApphostDirectory ✅ ▶️ View recording
✅ StopWithNoRunningAppHostExitsSuccessfully ✅ ▶️ View recording
✅ UnAwaitedChainsCompileWithAutoResolvePromises ✅ ▶️ View recording
❔ UpdateProjectChannelToStable_CSharpEmptyAppHost_PreservesAspireConfigChannel ❔ ▶️ View recording
✅ UpdateProjectChannelToStable_CSharpSingleFileInit_PreservesAspireConfigChannel ✅ ▶️ View recording
✅ UpdateProjectChannelToStable_TypeScriptSingleFileInit_PreservesAspireConfigChannel ✅ ▶️ View recording
✅ UpdateProjectChannelToStable_TypeScript_PreviewsStablePackagesAndPreservesChannel ✅ ▶️ View recording

📹 Recordings uploaded automatically from CI run #26517257157

@davidfowl
David Fowler (davidfowl) merged commit fd9cee2 into release/13.4 May 27, 2026
617 of 620 checks passed
@davidfowl
David Fowler (davidfowl) deleted the backport/pr-17491-to-release/13.4 branch May 27, 2026 16:21
@microsoft-github-policy-service microsoft-github-policy-service Bot added this to the 13.4 milestone May 27, 2026
aspire-repo-bot Bot added a commit to microsoft/aspire.dev that referenced this pull request May 27, 2026
Aspire now validates the Helm CLI version (>= 4.2.0) upfront before
deploying to Kubernetes. Missing or older Helm versions produce a clear
actionable error instead of cryptic flag failures like 'unknown flag:
--force-conflicts'. Update Prerequisites in both Kubernetes and AKS
deployment docs to reflect this minimum version requirement.

Documents changes from microsoft/aspire#17542.

Co-authored-by: Copilot <[email protected]>
@aspire-repo-bot

Copy link
Copy Markdown
Contributor Author

Pull request created: #1097

Generated by PR Documentation Check

@aspire-repo-bot

Copy link
Copy Markdown
Contributor Author

📝 Documentation has been drafted in microsoft/aspire.dev#1097 targeting release/13.4.

Updated the Prerequisites section in two Kubernetes deployment pages to specify Helm v4.2.0 or later, reflecting the new upfront Helm version validation added in the source PR.

Files modified:

  • src/frontend/src/content/docs/deployment/kubernetes/kubernetes.mdx
  • src/frontend/src/content/docs/deployment/kubernetes/aks.mdx

Note

This draft PR needs human review before merging.

David Pine (IEvangelist) added a commit to microsoft/aspire.dev that referenced this pull request Jun 1, 2026
* docs: require Helm v4.2.0+ for Kubernetes deployment

Aspire now validates the Helm CLI version (>= 4.2.0) upfront before
deploying to Kubernetes. Missing or older Helm versions produce a clear
actionable error instead of cryptic flag failures like 'unknown flag:
--force-conflicts'. Update Prerequisites in both Kubernetes and AKS
deployment docs to reflect this minimum version requirement.

Documents changes from microsoft/aspire#17542.

Co-authored-by: Copilot <[email protected]>

* Address review feedback (1 thread)

- Update shared Kubernetes prerequisites with Helm v4.2.0+ requirement (PRRT_kwDOQK_VN86FKpia)

Verified against microsoft/aspire@dfd226a on branch release/13.4.
Edited per the doc-writer skill.

Co-authored-by: Copilot <[email protected]>

---------

Co-authored-by: aspire-repo-bot[bot] <268009190+aspire-repo-bot[bot]@users.noreply.github.com>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: David Pine <[email protected]>
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 27, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants