Skip to content

Expose WithComputeEnvironment to polyglot AppHosts#17093

Merged
sebastienros merged 4 commits into
mainfrom
sebastienros/sebros-issue-17085-expose-withcomputeenv
May 18, 2026
Merged

Expose WithComputeEnvironment to polyglot AppHosts#17093
sebastienros merged 4 commits into
mainfrom
sebastienros/sebros-issue-17085-expose-withcomputeenv

Conversation

@sebastienros
Copy link
Copy Markdown
Contributor

@sebastienros sebastienros commented May 14, 2026

Description

WithComputeEnvironment was already available to C# app hosts but was excluded from the ATS/polyglot surface because IComputeEnvironmentResource was previously considered incompatible. The export path already supports resource-builder interface parameters like PublishWithContainerFiles, so this exposes the existing extension directly for polyglot app hosts.

This also updates the TypeScript, Java, Python, and Go polyglot apphost samples for Kubernetes and Docker so the generated SDKs compile calls against different IComputeEnvironmentResource implementations.

Fixes: #17085

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 14, 2026 19:56
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

Exposes the existing WithComputeEnvironment<T> extension method to polyglot AppHosts by replacing its [AspireExportIgnore] attribute with [AspireExport], and adds usage examples in the Kubernetes and Docker polyglot test apphosts (TypeScript, Java, Python, Go).

Changes:

  • Switch WithComputeEnvironment from AspireExportIgnore to AspireExport and remove the "not available in polyglot app hosts" remark.
  • Add withComputeEnvironment(...) calls in Kubernetes polyglot apphost samples across all 4 languages.
  • Add withComputeEnvironment(...) calls in Docker polyglot apphost samples across all 4 languages.

Reviewed changes

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

Show a summary per file
File Description
src/Aspire.Hosting/ResourceBuilderExtensions.cs Replace AspireExportIgnore with AspireExport on WithComputeEnvironment and drop the polyglot-unavailable remark.
tests/PolyglotAppHosts/Aspire.Hosting.Kubernetes/TypeScript/apphost.ts Exercise withComputeEnvironment on the Kubernetes container resource.
tests/PolyglotAppHosts/Aspire.Hosting.Kubernetes/Python/apphost.py Exercise with_compute_environment on the Kubernetes container resource.
tests/PolyglotAppHosts/Aspire.Hosting.Kubernetes/Java/AppHost.java Exercise withComputeEnvironment on the Kubernetes container resource.
tests/PolyglotAppHosts/Aspire.Hosting.Kubernetes/Go/apphost.go Exercise WithComputeEnvironment on the Kubernetes container resource.
tests/PolyglotAppHosts/Aspire.Hosting.Docker/TypeScript/apphost.ts Exercise withComputeEnvironment binding api to the compose environment.
tests/PolyglotAppHosts/Aspire.Hosting.Docker/Python/apphost.py Exercise with_compute_environment binding api to the compose environment.
tests/PolyglotAppHosts/Aspire.Hosting.Docker/Java/AppHost.java Exercise withComputeEnvironment binding api to the compose environment.
tests/PolyglotAppHosts/Aspire.Hosting.Docker/Go/apphost.go Exercise WithComputeEnvironment binding api to the compose environment.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 14, 2026

🚀 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 -- 17093

Or

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

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
sebastienros and others added 2 commits May 15, 2026 18:18
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@sebastienros sebastienros merged commit 4b9f6d9 into main May 18, 2026
297 checks passed
@sebastienros sebastienros deleted the sebastienros/sebros-issue-17085-expose-withcomputeenv branch May 18, 2026 16:23
@microsoft-github-policy-service microsoft-github-policy-service Bot added this to the 13.4 milestone May 18, 2026
@github-actions
Copy link
Copy Markdown
Contributor

CLI E2E Tests unknown — 86 passed, 0 failed, 1 unknown (commit 65b8480)

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
AspireAddPackageVersionToDirectoryPackagesProps ▶️ View recording
AspireInitSingleFileAppHostRunsViaDotnetRunAppHost ▶️ View recording
AspireInitWithExistingAppHostDirRecreatesMissingNuGetConfigAndPreservesFiles ▶️ View recording
AspireInitWithSolutionFileGeneratesAppHostThatBuildsAgainstChannelHive ▶️ 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_UsesConfiguredToolchain ▶️ View recording
DashboardRunWithOtelTracesReturnsNoTraces ▶️ 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 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
GlobalMigration_HandlesCommentsAndTrailingCommas ▶️ View recording
GlobalMigration_HandlesMalformedLegacyJson ▶️ View recording
GlobalMigration_PreservesAllValueTypes ▶️ View recording
GlobalMigration_SkipsWhenNewConfigExists ▶️ View recording
GlobalSettings_MigratedFromLegacyFormat ▶️ View recording
InitTypeScriptAppHost_AugmentsExistingViteRepoAtRoot ▶️ View recording
InteractiveCSharpInitCreatesExpectedFiles ▶️ View recording
InvalidAppHostPathWithComments_IsHealedOnRun ▶️ View recording
LatestCliCanStartStableChannelAppHost ▶️ View recording
LatestCliCanStartStableChannelTypeScriptAppHost ▶️ View recording
LegacySettingsMigration_AdjustsRelativeAppHostPath ▶️ View recording
LogLevelTrace_ProducesTraceEntriesInCliLogFile ▶️ View recording
LogsCommandShowsResourceLogs ▶️ View recording
OtelLogsReturnsStructuredLogsFromStarterApp ▶️ View recording
OtelLogsReturnsStructuredLogsFromStarterAppIsolated ▶️ View recording
PsCommandListsRunningAppHost ▶️ View recording
PsFormatJsonOutputsOnlyJsonToStdout ▶️ View recording
PublishWithConfigureEnvFileUpdatesEnvOutput ▶️ View recording
PublishWithDockerComposeServiceCallbackSucceeds ▶️ View recording
PublishWithoutOutputPathUsesAppHostDirectoryDefault ▶️ View recording
ResourceCommand_FailedExecution_DisplaysAppHostLogPathAndLogContainsEntries ▶️ View recording
ResourceCommand_FailsWhenInteractionServiceIsRequired ▶️ View recording
ResourceCommand_SetAndDeleteParameterUpdatesDescribeOutput ▶️ View recording
RestoreGeneratesSdkFiles ▶️ View recording
RestoreGeneratesSdkFiles_WithConfiguredToolchain ▶️ View recording
RestoreRefreshesGeneratedSdkAfterAddingIntegration ▶️ View recording
RestoreSupportsConfigOnlyHelperPackageAndCrossPackageTypes ▶️ View recording
RunFromParentDirectory_UsesExistingConfigNearAppHost ▶️ View recording
SecretCrudOnDotNetAppHost ▶️ View recording
SecretCrudOnTypeScriptAppHost ▶️ View recording
StagingChannel_ConfigureAndVerifySettings_ThenSwitchChannels ▶️ View recording
StartAndWaitForTypeScriptSqlServerAppHostWithNativeAssets ▶️ View recording
StopAllAppHostsFromAppHostDirectory ▶️ View recording
StopNonInteractiveSingleAppHost ▶️ View recording
StopWithNoRunningAppHostExitsSuccessfully ▶️ View recording
UnAwaitedChainsCompileWithAutoResolvePromises ▶️ View recording
UpdateProjectChannelToStable_TypeScript_PicksUpStablePackages ▶️ View recording

📹 Recordings uploaded automatically from CI run #26044248100

aspire-repo-bot Bot added a commit to microsoft/aspire.dev that referenced this pull request May 18, 2026
…Docker integration pages

WithComputeEnvironment is now available in polyglot (TypeScript, Python, Java, Go) app hosts
as of microsoft/aspire#17093. Expand the existing tip asides on the Kubernetes and Docker
integration pages to include C# and TypeScript code examples showing how to call the API.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@aspire-repo-bot
Copy link
Copy Markdown
Contributor

Pull request created: #997

Generated by PR Documentation Check

@aspire-repo-bot
Copy link
Copy Markdown
Contributor

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

The WithComputeEnvironment API was previously unavailable in polyglot app hosts; this PR expands the tip asides on the Kubernetes and Docker integration pages to show how to call the API in C# and TypeScript, and notes it is now available in TypeScript, Python, Java, and Go. Files updated: src/frontend/src/content/docs/integrations/compute/kubernetes.mdx, src/frontend/src/content/docs/integrations/compute/docker.mdx.

Note

This draft PR needs human review before merging.

nellshamrell pushed a commit to nellshamrell/aspire that referenced this pull request May 18, 2026
* Expose WithComputeEnvironment to polyglot AppHosts

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Update polyglot codegen snapshots

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

WithComputeEnvironment isn't exposed to Polyglot

3 participants