Expose Dockerfile builder APIs to polyglot apphosts#15867
Open
sebastienros wants to merge 3 commits intomainfrom
Open
Expose Dockerfile builder APIs to polyglot apphosts#15867sebastienros wants to merge 3 commits intomainfrom
sebastienros wants to merge 3 commits intomainfrom
Conversation
Re-enable the Dockerfile builder callback surface for TypeScript, Python, and Java apphosts through ATS-safe wrapper exports. Also add curated container-files wrapper exports, fix generator handling for duplicate handle/builder type IDs and run-capability naming, update the real polyglot validation apphosts, and refresh the affected codegen snapshots. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR exposes the programmatic Dockerfile builder flow to polyglot AppHosts (TypeScript/Python/Java) by exporting the needed ATS callback context and adding curated Dockerfile DSL wrapper exports, then updates polyglot validation fixtures and regenerates language snapshots to cover the new surface.
Changes:
- Export
AddDockerfileBuilder/WithDockerfileBuilder(async callback overloads) to ATS and exportDockerfileBuilderCallbackContext+ Dockerfile DSL handles. - Add curated ATS exports for the Dockerfile DSL (builder/stage statements + container-files helpers) while keeping internal helper extensions hidden from polyglot.
- Fix codegen edge cases around duplicate type IDs / capability collisions and refresh TS/Python/Java generated snapshots + validation AppHosts.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/PolyglotAppHosts/Aspire.Hosting/TypeScript/apphost.ts | Exercises the new Dockerfile builder callback surface in the TypeScript polyglot validation AppHost. |
| tests/PolyglotAppHosts/Aspire.Hosting/Python/apphost.py | Exercises the new Dockerfile builder callback surface in the Python polyglot validation AppHost. |
| tests/PolyglotAppHosts/Aspire.Hosting/Java/AppHost.java | Exercises the new Dockerfile builder callback surface in the Java polyglot validation AppHost. |
| tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.ts | Updates the TypeScript generated SDK snapshot to include Dockerfile builder/stage/context APIs and capabilities. |
| tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/HostingContainerResourceCapabilities.verified.txt | Updates the TS capability snapshot to include withDockerfileBuilder. |
| tests/Aspire.Hosting.CodeGeneration.Python.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.py | Updates the Python generated SDK snapshot to include Dockerfile builder/stage/context APIs and capabilities. |
| tests/Aspire.Hosting.CodeGeneration.Java.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.java | Updates the Java generated SDK snapshot to include Dockerfile builder/stage/context APIs and capabilities. |
| src/Aspire.Hosting/ContainerResourceBuilderExtensions.cs | Re-enables ATS export for async Dockerfile builder APIs and adjusts polyglot availability remarks. |
| src/Aspire.Hosting/Ats/DockerfileBuilderExports.cs | Adds curated ATS exports for Dockerfile DSL statements and container-files helpers. |
| src/Aspire.Hosting/ApplicationModel/DockerfileBuilderCallbackContext.cs | Marks the callback context as ATS-exported (property exposure enabled) for polyglot callbacks. |
| src/Aspire.Hosting/ApplicationModel/Docker/DockerfileStage.cs | Marks Dockerfile stage type as ATS-exported so it can flow through polyglot handles. |
| src/Aspire.Hosting/ApplicationModel/Docker/DockerfileBuilder.cs | Marks Dockerfile builder type as ATS-exported so it can flow through polyglot handles. |
| src/Aspire.Hosting/ApplicationModel/Docker/ContainerFilesExtensions.cs | Hides raw container-files extension exports in favor of curated ATS wrappers. |
| src/Aspire.Hosting.CodeGeneration.Python/AtsPythonCodeGenerator.cs | Deduplicates builder models by TypeId to prevent duplicate type/capability issues in Python generation. |
| src/Aspire.Hosting.CodeGeneration.Java/AtsJavaCodeGenerator.cs | Resolves duplicate handle types by AtsTypeId, preferring resource-builder variants when present. |
Contributor
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 15867Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 15867" |
Update the Go and Rust two-pass generated Aspire snapshots after the Dockerfile builder polyglot export changes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Update the AspireExportIgnore reasons on the synchronous Dockerfile builder overloads to reflect that only the async callback overload is exported to polyglot apphosts. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
|
🎬 CLI E2E Test Recordings — 55 recordings uploaded (commit View recordings
📹 Recordings uploaded automatically from CI run #23965587141 |
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.
Description
Expose the programmatic Dockerfile builder flow to polyglot AppHosts.
AddDockerfileBuilderandWithDockerfileBuilderfor ATS/code generation and export the Dockerfile builder callback surface needed by TypeScript, Python, and Java.Validation:
./dotnet.sh test tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.csproj -- --filter-method "*Scanner_HostingAssembly_ContainerResourceCapabilities" --filter-method "*TwoPassScanning_GeneratesWithEnvironmentOnTestRedisBuilder" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"./dotnet.sh test tests/Aspire.Hosting.CodeGeneration.Python.Tests/Aspire.Hosting.CodeGeneration.Python.Tests.csproj -- --filter-method "*TwoPassScanning_GeneratesWithEnvironmentOnTestRedisBuilder" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"./dotnet.sh test tests/Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.Java.Tests.csproj -- --filter-method "*TwoPassScanning_GeneratesWithEnvironmentOnTestRedisBuilder" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"aspire restore --non-interactive --apphost apphost.ts && npx tsc --noEmit --project tsconfig.jsonintests/PolyglotAppHosts/Aspire.Hosting/TypeScriptaspire restore --non-interactive --apphost apphost.pyplus Python compile intests/PolyglotAppHosts/Aspire.Hosting/Pythonaspire restore --non-interactive --apphost AppHost.java && javac --enable-preview --source 25 -d .java-build @.modules/sources.txt AppHost.javaintests/PolyglotAppHosts/Aspire.Hosting/JavaFixes #15858
Checklist
<remarks />and<code />elements on your triple slash comments?aspire.devissue: