Add ConfigureEnvFile support to polyglot Docker app hosts#15819
Add ConfigureEnvFile support to polyglot Docker app hosts#15819sebastienros merged 8 commits intomainfrom
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 15819Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 15819" |
There was a problem hiding this comment.
Pull request overview
Adds ConfigureEnvFile support to Docker Compose polyglot AppHosts (TypeScript/Python/Java) by exporting the C# API to ATS, projecting CapturedEnvironmentVariable for mutation, and extending ATS collection plumbing so typed Dict/List handles work correctly through callback parameters.
Changes:
- Export
DockerComposeEnvironmentExtensions.ConfigureEnvFileto ATS and projectCapturedEnvironmentVariableas a mutable exported handle type (with limited ignored members). - Update ATS collection exports + capability scanning/analyzers/tests to support non-generic
IDictionary/IListand typed mutableDict/Listhandles. - Extend polyglot validation fixtures and add an E2E publish test asserting
.envoutput is modified by the callback.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/PolyglotAppHosts/Aspire.Hosting.Docker/TypeScript/apphost.ts | Exercises configureEnvFile in the TypeScript Docker Compose validation AppHost. |
| tests/PolyglotAppHosts/Aspire.Hosting.Docker/Python/apphost.py | Exercises configure_env_file in the Python Docker Compose validation AppHost. |
| tests/PolyglotAppHosts/Aspire.Hosting.Docker/Java/AppHost.java | Exercises configureEnvFile in the Java Docker Compose validation AppHost. |
| tests/Aspire.Hosting.RemoteHost.Tests/CapabilityDispatcherTests.cs | Adds coverage ensuring List.get / Dict.get work for typed mutable collections returned as handles. |
| tests/Aspire.Hosting.RemoteHost.Tests/AtsCapabilityScannerTests.cs | Validates ATS type mapping for non-generic IDictionary/IList. |
| tests/Aspire.Hosting.CodeGeneration.Java.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.java | Updates expected generated Java snapshot for new dict helpers. |
| tests/Aspire.Hosting.CodeGeneration.Java.Tests/Snapshots/AtsGeneratedAspire.verified.java | Updates expected generated Java snapshot for new dict helpers. |
| tests/Aspire.Hosting.Analyzers.Tests/AspireExportAnalyzerTests.cs | Ensures analyzer allows non-generic IDictionary/IList in exported signatures. |
| tests/Aspire.Cli.EndToEnd.Tests/TypeScriptPublishTests.cs | Adds E2E test asserting configureEnvFile mutates published artifacts/.env. |
| src/Aspire.Hosting/Ats/CollectionExports.cs | Switches intrinsic Dict/List capability exports to non-generic collection interfaces to support typed mutable collections. |
| src/Aspire.Hosting.RemoteHost/AtsCapabilityScanner.cs | Maps non-generic IDictionary/IList to ATS Dict/List and emits full AtsTypeRef metadata. |
| src/Aspire.Hosting.Integration.Analyzers/AspireExportAnalyzer.cs | Allows non-generic IDictionary/IList as ATS-compatible collection types. |
| src/Aspire.Hosting.Docker/DockerComposeEnvironmentExtensions.cs | Exports configureEnvFile to ATS for Docker Compose environments. |
| src/Aspire.Hosting.Docker/CapturedEnvironmentVariable.cs | Exposes env var metadata as an exported handle type with mutable properties for polyglot callbacks. |
| src/Aspire.Hosting.CodeGeneration.TypeScript/AtsTypeScriptCodeGenerator.cs | Ensures callback parameters that are mutable dictionaries are converted to AspireDict wrappers. |
| src/Aspire.Hosting.CodeGeneration.Java/Resources/Base.java | Adds mutable AspireDict accessors needed by the callback shape (get/put/remove/keys/etc.). |
3b9a3bd to
f34819b
Compare
d6d7790 to
83a6d12
Compare
JamesNK
left a comment
There was a problem hiding this comment.
Two minor observations (1 empty catch block concern, 1 unintentional BOM in snapshots). Overall the changes look solid — the NormalizeDictionaryKey approach, the analyzer + scanner extensions for non-generic collections, and the TS code generator refactoring are all clean.
tests/Aspire.Hosting.CodeGeneration.Java.Tests/Snapshots/AtsGeneratedAspire.verified.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
b8a1480 to
fbcd76a
Compare
|
🎬 CLI E2E Test Recordings — 69 recordings uploaded (commit View recordings
📹 Recordings uploaded automatically from CI run #24352817074 |
* Add ConfigureEnvFile polyglot parity Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix polyglot dict key handling Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Remove redundant AspireExport IDs Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Clarify CapturedEnvironmentVariable export scope Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Export env file source union Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix polyglot union codegen Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Restore TypeScript generator handle helper Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Address follow-up review comments Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Description
This adds
ConfigureEnvFileparity for Docker Compose polyglot AppHosts so generated TypeScript, Python, and Java SDKs can customize captured.enventries the same way the C# surface already can. The main goal is to unblock the TypeScript issue path without widening scope into broader Docker Compose projection work.The change exports
ConfigureEnvFileto ATS, projectsCapturedEnvironmentVariablejust enough for mutation, and updates the shared ATS/runtime pieces needed for typedDict/Listhandles to flow through callback parameters correctly. On top of that, the Docker polyglot validation AppHosts now exercise the env-file callback in TypeScript, Python, and Java, the Java shared runtime now exposes mutableAspireDictaccessors needed for that callback shape, and the focused TypeScript publish validation asserts that the generatedartifacts/.envoutput changes.Fixes #15704
Checklist
<remarks />and<code />elements on your triple slash comments?aspire.devissue: