Skip to content

Warn for Go and fail for Python publish when an existing Dockerfile ignores the entrypoint - #21186

Merged
David Pine (IEvangelist) merged 8 commits into
mainfrom
ievangelist-go-dockerfile-19070
Oct 29, 2026
Merged

David Pine (IEvangelist) merged 8 commits into
mainfrom
ievangelist-go-dockerfile-19070

Conversation

@IEvangelist

@IEvangelist David Pine (IEvangelist) commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

Description

Publishing a Go or Python app that has its own Dockerfile in the app directory silently ignored the entrypoint the resource was given. AddGoApp skips Dockerfile generation when a Dockerfile exists, so a non-default packagePath never reached the image. AddPython* does the same for an entrypoint changed with WithEntrypoint(...). JavaScript already fails loudly in the same situation. Python now fails the same way, and Go warns.

With an existing app-directory Dockerfile, publish now reports when the resource carries an entrypoint the Dockerfile cannot honor. Both languages do it from a validate-{go,python}-...-{name} pipeline step that is required by Build and Publish, and the resource's own image build (the BuildCompute step that Azure Container Apps, App Service, Docker Compose and Kubernetes deployments select directly) waits for it. The step does nothing for a resource excluded from the manifest, because that resource is never published. The message names the resource, the requested package or entrypoint and the Dockerfile path. It is bypassed by PublishAsDockerFile(c => c.WithEntrypoint(...)), which sets the container entrypoint explicitly.

  • Go warns: the step logs a publish-time warning when the container has no explicit entrypoint and packagePath resolves to something other than the app directory. AddGoApp records a GoPackagePathAnnotation for any path other than the literal ".", so the guard also treats "./" and "./." as the app directory. It does not throw, because a custom Dockerfile can already build and run the requested package and failing would break apps that publish correctly today. Build tags, ldflags, gcflags and the race detector are build configuration, not entrypoint selection, so they do not warn (a test documents this). The warning comes from the pipeline step, so a manifest-only publish (--publisher manifest, as used by azd) does not show it.
  • Python fails: the guard throws a DistributedApplicationException from the manifest callback and from the pipeline step, the same two places as the JavaScript guard. It fires only when the effective entrypoint differs from the one passed to AddPython*, meaning a later WithEntrypoint(...) re-pointed it. Python has no default entrypoint and apps that ship their own Dockerfile are expected to run it, so a broad throw would break them. Re-stating the same entrypoint is not a conflict, and a Script entrypoint is compared after it is resolved against the app directory, so ./main.py is the same file as main.py.
  • No resx changes: the JavaScript, Go and Python hosting packages use inline messages.
  • No repo sample is affected. A search of the playground, the CLI templates and the E2E tests found no WithEntrypoint(EntrypointType...) and no non-default Go packagePath. The Go starter uses AddGoApp("api", "./api"), which is the default package path.
  • A pipeline step, not a step annotation: PublishAsDockerFile(c => c.WithDockerfile(path)) calls WithDockerfile on a container that already has the validation, and WithDockerfile replaces the container's PipelineStepAnnotation. A validation kept as a second annotation on the container makes that call throw Sequence contains more than one element, and a single one would be silently removed. Go and Python therefore add the step with Pipeline.AddStep, the way the Docker Compose, Kubernetes and Azure environments register their own steps, which leaves the container's annotations alone. PublishAsDockerFileWithDockerfileWarnsFromValidationStepWhenPackagePathIsNotDefault (Go) and PublishAsDockerFileWithDockerfileThrowsFromValidationStepWhenEntrypointIsChanged (Python) cover it. The change touches no shared Aspire.Hosting code and adds no public API.

Go users whose custom Dockerfile already builds the requested package will see the warning and can silence it by setting an explicit container entrypoint or by renaming the Dockerfile so Aspire generates one. Python users with a custom Dockerfile who re-point the entrypoint with WithEntrypoint(...) now need to do the same, as with JavaScript.

Fixes #19070

Validation

.\restore.cmd passed. Each row below is dotnet test --project tests\<Project>\<Project>.csproj --no-launch-profile -- [--filter-class <classes>] --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true" on the final head, and each exited 0. A row with no classes ran the whole project.

Project Classes Result
Aspire.Hosting.Go.Tests all 110 passed
Aspire.Hosting.Python.Tests all 121 passed
Aspire.Hosting.Tests PythonAppDeployPipelineTests, WithReferenceTests 66 passed
Aspire.Hosting.Foundry.Tests all (it uses AddPythonApp widely) 197 passed

The new tests cover Go (11 methods, one a three-row theory) and Python (14 methods, one a four-row theory): the Go warning and the Python throw for an existing Dockerfile, the explicit PublishAsDockerFile entrypoint bypass, the validation step surviving PublishAsDockerFile(c => c.WithDockerfile(...)), resources excluded from the manifest, the validation step running before the image build, and the cases that must not warn or throw (Go ".", "./" and "./.", and Python restating main.py as ./main.py). The Go tests capture the pipeline step's log through TestPipelineActivityReporter, assert the whole warning text, and assert that nothing is logged otherwise. One Azure Container Apps test in Aspire.Hosting.Tests asserts the Deploy graph contains the Python validation step. A Verify snapshot covers Python publish without a Dockerfile after WithEntrypoint(...). Python 3.14 was installed, so the [RequiresTools(["python"])] tests ran too.

Not run on the dev machine: the Linux and macOS path assertions, and the rest of Aspire.Hosting.Tests (the change touches no code in that project). GitHub CI covers them.

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

When the app directory already contains a Dockerfile, AddGoApp skips Dockerfile generation, so a non-default packagePath was silently dropped from the published image. Throw while writing the manifest and from a pipeline validation step, mirroring the JavaScript run script guard, unless the user sets an explicit container entrypoint with PublishAsDockerFile(...). Build flags and the race detector are not entrypoint selection and are left alone. Part of #19070.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: c8717a87-0ee5-4296-a6fd-ea6e2d91a57e
When the app directory already contains a Dockerfile, AddPython* skips Dockerfile generation, so an entrypoint changed with WithEntrypoint(...) was silently dropped from the published image. Throw while writing the manifest and from a pipeline validation step, mirroring the JavaScript run script guard, unless the user sets an explicit container entrypoint with PublishAsDockerFile(...). Python has no default entrypoint and apps that ship their own Dockerfile are expected to run it, so only an entrypoint that differs from the one passed to AddPython* is treated as an explicit request. Part of #19070.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: c8717a87-0ee5-4296-a6fd-ea6e2d91a57e
@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 -- 21186

Or

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

@aspire-repo-bot
aspire-repo-bot Bot requested a balanced review from Copilot October 20, 2026 05:10
@github-actions github-actions Bot added the area-integrations Issues pertaining to Aspire Integrations packages label Oct 20, 2026
@github-actions

This comment has been minimized.

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.

🟡 Changes recommended

Validation blocks excluded resources, and the added pipeline annotations break subsequent Dockerfile customization.

3 open issues
What changed in this PR

Adds publish-time guards for Go and Python apps whose existing Dockerfiles may ignore configured entrypoints, following JavaScript’s existing behavior.

Changes:

  • Adds manifest and Build/Publish pipeline validation.
  • Preserves supported defaults and explicit container entrypoint overrides.
  • Adds regression tests and a Python Dockerfile snapshot.
File Description
src/​Aspire.Hosting.Go/​GoHostingExtensions.cs Validates non-default Go package paths.
src/​Aspire.Hosting.Python/​PythonAppResourceBuilderExtensions.cs Validates changed Python entrypoints.
tests/​Aspire.Hosting.Go.Tests/​AddGoAppTests.cs Tests Go validation and bypass cases.
tests/​Aspire.Hosting.Python.Tests/​AddPythonAppTests.cs Tests Python validation and Dockerfile generation.
tests/​Aspire.Hosting.Python.Tests/​Snapshots/​AddPythonAppTests.PublishWithoutDockerfileGeneratesDockerfileWhenEntrypointIsChanged.verified.txt Records the generated module entrypoint.

Review effort: Balanced

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Found 1 additional correctness issue: the new Go/Python entrypoint validation is bypassed by the Azure deployment dependency graph. Existing review comments were not duplicated.

Validation: 7 focused Go regression cases and 10 focused Python regression cases passed. A temporary Azure Container Apps pipeline-graph regression test reproduced the missing validation dependency; it was removed afterward. The broader Go test-class run had 43 passes and 11 snapshot failures caused by CRLF baseline line endings in the local checkout.

EnsureBuildAndPushPipelineAnnotations registered its steps with
ResourceAnnotationMutationBehavior.Replace, which resolves to
Annotations.OfType<PipelineStepAnnotation>().SingleOrDefault(). A
container that also carries another PipelineStepAnnotation, such as the
Go and Python Dockerfile validators, made the next WithDockerfile call
throw "Sequence contains more than one element", and a single annotation
added by a caller was silently dropped.

Register the build and push steps with an internal annotation type so
Replace only ever replaces that registration. Consumers still collect
the steps through OfType<PipelineStepAnnotation>().

Two registrants relied on the old replace-everything behavior:
- EF migration bundle containers re-registered the migration step that
  AddEFMigrationsCore already adds, so it would now be emitted twice.
- Dotnet program publishing adds SDK build steps that the container
  conversion in PublishAsDockerFile used to wipe, so it would now emit a
  second build step. Skip it unless the resource still supports it.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: c8717a87-0ee5-4296-a6fd-ea6e2d91a57e
The validation step added for an existing Dockerfile ran for every Go
and Python app, including resources excluded from the manifest with
ExcludeFromManifest(). Those apps are never published, yet a conflicting
package path or entrypoint failed the Build and Publish steps and blocked
unrelated resources. Return no step for them, like the container build
step factory does.

The manifest path needs no change: an excluded resource is written with
a null callback, so the validating callback never runs for it.

Also cover the case from review where PublishAsDockerFile is followed by
WithDockerfile in publish mode: it no longer throws and the validation
still fires, and an explicit WithEntrypoint still bypasses it.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: c8717a87-0ee5-4296-a6fd-ea6e2d91a57e
The validation step was only required by the aggregate Build and Publish
steps. Deploy environments such as Azure Container Apps, App Service,
Docker Compose and Kubernetes select each resource's BuildCompute step
directly and do not depend on those aggregates, so a conflicting
existing Dockerfile was still built and deployed without any error.

Make the resource's own image build step depend on the validation step.
This does not hardcode the build step name, and it is a no-op for
resources excluded from publish, which have neither step.

The new tests assert on the dependency graph instead of running the
validation step directly: the build step closure contains the validation
step for Go and Python, and the Azure Container Apps Deploy closure
contains it for a Python app. There is no Go equivalent of the latter
because Aspire.Hosting.Tests does not reference Aspire.Hosting.Go.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: c8717a87-0ee5-4296-a6fd-ea6e2d91a57e
@github-actions

This comment has been minimized.

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.

🟢 Approval recommended

No unresolved blocking issues remain, and focused regression coverage addresses validation and shared pipeline behavior.

No open issues 🎉

3 resolved since last review

Review effort: Balanced

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

Add the validation steps with Pipeline.AddStep instead of as a
PipelineStepAnnotation on the container. WithDockerfile replaces the
container's step annotation, so an annotation step would be dropped, or
would make the registration throw, when PublishAsDockerFile configures
the Dockerfile again. A pipeline step is not affected, so the shared
WithDockerfile, EF migration and .NET program publishing changes are no
longer needed and are reverted.

The step is always registered and does nothing for a resource that is
excluded from the manifest. The tests use the application's pipeline,
because only that pipeline contains steps added with Pipeline.AddStep.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: c8717a87-0ee5-4296-a6fd-ea6e2d91a57e
@github-actions

This comment has been minimized.

@IEvangelist
David Pine (IEvangelist) marked this pull request as ready for review October 21, 2026 21:45

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.

Thanks for this. The validation mechanics look solid: the guard only inspects annotations, so Dockerfile contents can't cause false positives, and the step ordering, exclusion handling and WithDockerfile reconfiguration are well covered by the tests. I'm leaving this as a comment rather than an approval because of one behavior question.

To resolve before approval: the Go guard fails publish whenever packagePath is not ".", even when the app's own Dockerfile already builds and runs that package correctly. The inline comment has the details.

Other points (non-blocking):

  • AddGoApp adds GoPackagePathAnnotation when packagePath != "." (line 287, outside this diff), so "./" or "./.", which mean the same as the default, now fail publish when an existing Dockerfile is present. Normalizing the value before that check would avoid this.
  • The JavaScript guard (JavaScriptHostingExtensions.cs) still registers its validation as a PipelineStepAnnotation on the container, the pattern this PR moved away from because a later PublishAsDockerFile(c => c.WithDockerfile(...)) drops it or throws. That could be a follow-up issue.
  • Optional: the Go and Python registration blocks (manifest callback, Pipeline.AddStep, BuildCompute dependency) are nearly identical. A small shared internal helper would keep the languages from drifting.

Go: emit a publish-time warning instead of throwing when an existing Dockerfile is published with a non-default package path, so apps whose Dockerfile already builds that package keep publishing. './' and './.' are treated as the default package path.

Python: compare Script entrypoints after resolving them against the app directory so restating 'main.py' as './main.py' is not reported as a conflict.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 74f4d906-4ced-495b-b816-c2983ca25399
@aspire-repo-bot
aspire-repo-bot Bot requested a balanced review from Copilot October 27, 2026 21:58
@IEvangelist David Pine (IEvangelist) changed the title Fail Go and Python publish when an existing Dockerfile ignores the entrypoint Warn for Go and fail for Python publish when an existing Dockerfile ignores the entrypoint Oct 27, 2026
@github-actions

This comment has been minimized.

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.

🟢 Approval recommended

No active review issues remain for the Go and Python Dockerfile configuration checks.

No open issues 🎉

Review effort: Balanced

Resolve the AddGoAppTests.cs conflict by keeping both the new Go certificate trust tests from main and this PR's Dockerfile validation tests and helpers.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 74f4d906-4ced-495b-b816-c2983ca25399
@github-actions

Copy link
Copy Markdown
Contributor

Tests selector

11 / 100 PR test projects · 2 PR jobs, from 7 changed files.

Selected PR test projects (11 / 100)

Aspire.Cli.EndToEnd.Tests, Aspire.Hosting.Azure.Kubernetes.Tests, Aspire.Hosting.Azure.Tests, Aspire.Hosting.Blazor.Tests, Aspire.Hosting.Dotnet.Tests, Aspire.Hosting.Foundry.Tests, Aspire.Hosting.Go.Tests, Aspire.Hosting.Python.Tests, Aspire.Hosting.Radius.Tests, Aspire.Hosting.Tests, Aspire.Playground.Tests

Selected PR jobs (2)

polyglot, typescript-api-compat


How these were chosen — grouped by what changed

⚠️ 6 of the 11 selected test projects come from a single change — tests/Aspire.Hosting.Tests/PythonAppDeployPipelineTests.cs.

🧪 tests/Aspire.Hosting.Tests/PythonAppDeployPipelineTests.cs (changed test)
→ 1 directly: Aspire.Hosting.Tests
→ 5 via the project graph: Aspire.Hosting.Azure.Kubernetes.Tests (2 hops), Aspire.Hosting.Azure.Tests, Aspire.Hosting.Blazor.Tests, Aspire.Hosting.Dotnet.Tests, Aspire.Hosting.Radius.Tests

🔧 src/Aspire.Hosting.Python/PythonAppResourceBuilderExtensions.cs (changed source)
→ 1 directly: Aspire.Hosting.Python.Tests
→ 2 via the project graph: Aspire.Hosting.Foundry.Tests, Aspire.Playground.Tests (2 hops)

📦 affected project Aspire.Hosting.Python
→ 1 test: Aspire.Cli.EndToEnd.Tests

🔧 src/Aspire.Hosting.Go/GoHostingExtensions.cs (changed source)
→ 1 directly: Aspire.Hosting.Go.Tests

🧪 tests/Aspire.Hosting.Go.Tests/AddGoAppTests.cs (changed test)
→ 1 directly: Aspire.Hosting.Go.Tests

🧪 tests/Aspire.Hosting.Go.Tests/Aspire.Hosting.Go.Tests.csproj (changed test)
→ 1 directly: Aspire.Hosting.Go.Tests

🧪 tests/Aspire.Hosting.Python.Tests/AddPythonAppTests.cs (changed test)
→ 1 directly: Aspire.Hosting.Python.Tests

🧪 tests/Aspire.Hosting.Python.Tests/Snapshots/AddPythonAppTests.PublishWithoutDockerfileGeneratesDockerfileWhenEntrypointIsChanged.verified.txt (changed test)
→ 1 directly: Aspire.Hosting.Python.Tests

Job reasons

Job Triggered by
polyglot affected project Aspire.Hosting.Go
typescript-api-compat affected project Aspire.Hosting.Go

Selection computed for commit ce93850.

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.

🟢 Approval recommended

No active review issues are reported for the changes that flag Go package-path and Python entrypoint mismatches when publishing with user-supplied Dockerfiles.

No open issues 🎉

Review effort: Balanced

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@IEvangelist
David Pine (IEvangelist) merged commit 716fa48 into main Oct 29, 2026
537 of 544 checks passed
@microsoft-github-policy-service microsoft-github-policy-service Bot added this to the 17.0 milestone Oct 29, 2026
@aspire-repo-bot

Copy link
Copy Markdown
Contributor

Pull request created: #1979

Generated by PR Documentation Check · copilot · auto · 27.5 AIC · ⌖ 1.15 AIC · ⊞ 7.1K

@aspire-repo-bot

Copy link
Copy Markdown
Contributor

📝 Documentation has been drafted in microsoft/aspire.dev#1979 targeting release/17.0.

Documents the new publish behavior with an existing Dockerfile: Go warns, Python fails when the entrypoint is changed. Updated python.mdx and go/go-host.mdx. Triggered signal: pr_body_has_cli_flag_mention (PR body mentions --publisher manifest).

Note

This draft PR needs human review before merging.

David Pine (IEvangelist) added a commit that referenced this pull request Nov 5, 2026
> [!IMPORTANT]
> **Merge last.** This PR depends on the other open Go AppHost PRs and
must land after them.
>
> - **Must land first**, because each adds references to the flag that
this PR has to delete: #21189 (E2E helper and call sites), #21195
(`SdkExportCommandTests`) and #21196 (`GoAppHostToolingCheck` and its
tests).
> - **Must land first**, because it edits the same hunk of
`DefaultLanguageDiscovery.cs` and this PR rebases onto it: #21191.
> - **Should land first**, because removing the flag turns Go on for
everyone and these fixes should ship before it: #21186, #21187, #21188,
#21193, #21194, #21197 and #21199.

## Description

Removes the `experimentalPolyglotGo` feature flag so Go AppHosts are
available by default, the same way TypeScript AppHosts are. With no
flag, **Empty (Go AppHost)** and **Starter App (Go API + Redis, Go
AppHost)** are offered by interactive and non-interactive `aspire new`,
and Go is offered by `aspire init` language selection and `--language
go`.

**This is the GA switch for the Go AppHost epic (#21115) and must merge
last**, after the other children have landed: #21108 (E2E, publish,
deploy), #21110 (support policy, API review, packaging), #21112 (docs
and samples) and #21114 (VS Code debugging). It was opened as a draft so
CI exercises the 52 Go fixtures without the flag. It is ready for review
now, but not for merging.

What changed:

- **CLI:** `KnownFeatures` drops the Go flag and
`DefaultLanguageDiscovery` no longer marks Go experimental.
`LanguageInfo.IsExperimental` is kept because Python, Java and Rust
still use it.
- **Leftover key:** a stale `experimentalPolyglotGo` in a user's
configuration is ignored with no warning, matching what happened to the
TypeScript flag when it was removed. `Features` only reads named keys,
and the extension schemas set `additionalProperties: false`, so VS Code
flags the stale key.
- **Extension schemas:** `aspire-config`, `aspire-global-settings` and
`aspire-settings` are regenerated with
`extension/scripts/generate-schema.js`. Only the 16-line Go block is
removed from each.
- **Fixtures and CI:** 52
`tests/PolyglotAppHosts/*/Go/aspire.config.json` files and
`.github/workflows/polyglot-validation/Dockerfile.golang` no longer set
the key.
- **Java E2E picker offsets:** Go is always listed now, so with only the
Java flag set the `aspire init` language picker is C#, TypeScript, Go,
Java, and Java needs 3 Down presses instead of 2. The first CI run on
this PR timed out waiting for `> Java` in `JavaPolyglotTests`,
`JavaCodegenValidationTests` and `JavaPolyglotApphostDirectoryTests`;
each now presses Down once more, with a comment stating the picker
order. The order comes from `DefaultLanguageDiscovery`,
`LanguageService` and `CliTemplateFactory`. TypeScript flows are
unaffected because TypeScript sorts before Go.
- **Tests:** `DefaultLanguageDiscoveryTests`, `NewCommandTests`,
`ConfigCommandTests`, `NewCommandTemplateConfigPersistenceTests` and
`InitCommandTests` now expect Go without the flag, with 6 new tests. One
of them, `GetAvailableLanguagesAsync_ListsLanguagesInPickerOrder`, pins
the picker order so a future ungated language fails a unit test before
it breaks a Docker E2E run.
- **Docs:** `docs/specs/polyglot-apphost.md`, the Go code generation
README and `playground/GoAppHost/apphost.go` no longer mention the flag.

Fixes #21106

## Validation

| Command | Result |
| --- | --- |
| `.\restore.cmd` | passed |
| `dotnet build
tests\Aspire.Cli.EndToEnd.Tests\Aspire.Cli.EndToEnd.Tests.csproj -m:2
--no-restore` | 0 warnings, 0 errors |
| `dotnet test --project tests\Aspire.Cli.Tests\Aspire.Cli.Tests.csproj
--no-launch-profile -- --filter-class "*.DefaultLanguageDiscoveryTests"
--filter-class "*.NewCommandTests" --filter-class "*.ConfigCommandTests"
--filter-class "*.NewCommandTemplateConfigPersistenceTests"
--filter-class "*.InitCommandTests" --filter-not-trait
"quarantined=true" --filter-not-trait "outerloop=true"` | 312 passed, 0
failed (run before the picker-order test was added) |
| `dotnet test --project tests\Aspire.Cli.Tests\Aspire.Cli.Tests.csproj
--no-launch-profile -- --filter-class "*.DefaultLanguageDiscoveryTests"
--filter-not-trait "quarantined=true" --filter-not-trait
"outerloop=true"` | 39 passed, 0 failed (38 existing plus the
picker-order test) |
| `node extension\scripts\generate-schema.js` | only the Go block was
removed from each schema |
| repository-wide search for `experimentalPolyglotGo` and its variants |
0 hits |
| JSON parse of the 53 fixtures and 3 schemas | all parse, none contain
the flag |

Run in PR CI instead of locally, all passing on `0e65752d44`: the three
Java E2E tests (`JavaPolyglotTests`, `JavaCodegenValidationTests` and
`JavaPolyglotApphostDirectoryTests`; they need Docker, so CI was the
first execution of the extra Down press), `Infrastructure.Tests` and the
VS Code extension unit and E2E jobs.

Not run: the VS Code new-project flow in an extension host
(`extension/src/commands/new.ts` just runs `aspire new`).

### Before merging

- [ ] Search again for `experimentalPolyglotGo`,
`KnownFeatures.ExperimentalPolyglotGo`,
`EnableExperimentalGoSupportAsync`, `features__experimentalPolyglotGo`
and `experimentalPolyglot:go`, because open Go branches add flag setup
of their own and this PR must merge after all of them. Today that covers
#21189 (the `EnableExperimentalGoSupportAsync` helper and its call sites
in every Go scenario), #21195 (`SdkExportCommandTests` sets
`KnownFeatures.ExperimentalPolyglotGo`) and #21196
(`GoAppHostToolingCheckTests` builds its language discovery with the
flag, including a `goEnabled: false` case that stops being meaningful,
and `GoAppHostToolingCheck` has a comment that describes the flag). Each
of them stops compiling or goes stale once the flag is removed, so
delete or rewrite them here.
- [ ] Rebase onto #21191, which adds `DefaultHostingPackages =
["Aspire.Hosting.Go"]` to Go's `LanguageInfo` in the same hunk of
`DefaultLanguageDiscovery.cs` (#21045). Keep that initializer and drop
`IsExperimental: true`.
- [ ] Drop the Go experimental notes in the aspire.dev API reference and
docs at the same time.

## Checklist

- Is this feature complete?
  - [ ] Yes. Ready to ship.
  - [x] No. Follow-up changes expected.
- Are you including unit tests for the changes and scenario tests if
relevant?
  - [x] 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
  - [x] 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
  - [x] No

---------

Co-authored-by: David Pine <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Copilot-Session: c8717a87-0ee5-4296-a6fd-ea6e2d91a57e
David Pine (IEvangelist) added a commit that referenced this pull request Nov 6, 2026
…ipeline registration (#21461)

## Description

Part of #21205. Aligns the JavaScript existing-Dockerfile run-script
validator (`validate-javascript-dockerfile-run-script-{name}`) with the
Go and Python validators fixed in #21186.

### Bugs on `main`, each reproduced by a new test

1. **Excluded resources still fail publish.** A JavaScript app with an
existing Dockerfile and an explicit run script that is marked
`ExcludeFromManifest()` still runs the validator and throws `JavaScript
app resource 'js' is configured to run script 'migrate', but publish is
using the existing Dockerfile ...`. The resource isn't published at all,
so this failure is spurious.
2. **`PublishAsDockerFile(c => c.WithDockerfile(...))` crashes in
publish mode.** The validator was a second `PipelineStepAnnotation` on
the container. `WithDockerfile` calls
`EnsureBuildAndPushPipelineAnnotations`, which adds its annotation with
`ResourceAnnotationMutationBehavior.Replace` and then fails with
`InvalidOperationException: Sequence contains more than one element`.
3. **Deploy graphs skip the validator.** It was only `RequiredBySteps =
[Build, Publish]`. Azure Container Apps and App Service select a
resource's `BuildCompute` steps directly, so `build-{name}` never
depended on the validator.

### Fix

This is the same shape #21186 merged for Go and Python:
- Register the step through `builder.Pipeline.AddStep`, so it's no
longer a container annotation that `WithDockerfile` can replace.
- Skip validation when
`containerBuilder.Resource.IsExcludedFromPublish()`.
- Make the container's `BuildCompute` steps depend on the validation
step through `WithPipelineConfiguration`.

The existing test
`PublishPipelineWithExistingDockerfileThrowsFromValidationStepWhenRunScriptNameIsExplicit`
built a bare `new DistributedApplicationPipeline()`, which doesn't
contain steps added through `builder.Pipeline`. It now resolves the
app's `IDistributedApplicationPipeline`, as the Go and Python tests in
#21186 do. Its assertions are unchanged.

Not in this PR (remaining #21205 items): the Next.js standalone check's
`BuildCompute` dependency and a shared helper across Go, Python and
JavaScript.

### Before/after (local)

| Test | Before (`main` source) | After |
|---|---|---|
| `PublishPipelineValidationStepIsNoOpForResourceExcludedFromManifest` |
❌ `DistributedApplicationException: JavaScript app resource 'js' is
configured to run script 'migrate' ...` | ✅ |
| `PublishPipelineValidationStepSurvivesLaterWithDockerfile` | ❌
`InvalidOperationException: Sequence contains more than one element`
(from `WithDockerfile`) | ✅ |
| `PublishPipelineRunsValidationStepBeforeImageBuildStep` | ❌
`Assert.Contains() Failure: Filter not matched` (validator not in the
`build-js` closure) | ✅ |

- The four `*PublishPipeline*` tests pass in 20/20 repeated runs.
- Full `Aspire.Hosting.JavaScript.Tests`: 408/427 pass locally. The 19
failures are environmental and unrelated:
- Bun and Deno functional tests fail in 0ms because those tools aren't
installed.
- Verify snapshot tests fail because the sandbox HOME is `/root`, which
the scrubber rewrites inside `/root/.cache`. With a different HOME, all
101 snapshot tests pass.

## Checklist

- Is this feature complete?
  - [ ] Yes. Ready to ship.
  - [x] No. Follow-up changes expected.
- Are you including unit tests for the changes and scenario tests if
relevant?
  - [x] 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
  - [x] 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
  - [x] No

**🤖 Posted by AspireAgent (AI Agent)**

---------

Co-authored-by: davidfowl <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: David Pine <[email protected]>
Co-authored-by: IEvangelist <[email protected]>
Mitch Denny (mitchdenny) pushed a commit that referenced this pull request Nov 10, 2026
…ipeline registration (#21461)

## Description

Part of #21205. Aligns the JavaScript existing-Dockerfile run-script
validator (`validate-javascript-dockerfile-run-script-{name}`) with the
Go and Python validators fixed in #21186.

### Bugs on `main`, each reproduced by a new test

1. **Excluded resources still fail publish.** A JavaScript app with an
existing Dockerfile and an explicit run script that is marked
`ExcludeFromManifest()` still runs the validator and throws `JavaScript
app resource 'js' is configured to run script 'migrate', but publish is
using the existing Dockerfile ...`. The resource isn't published at all,
so this failure is spurious.
2. **`PublishAsDockerFile(c => c.WithDockerfile(...))` crashes in
publish mode.** The validator was a second `PipelineStepAnnotation` on
the container. `WithDockerfile` calls
`EnsureBuildAndPushPipelineAnnotations`, which adds its annotation with
`ResourceAnnotationMutationBehavior.Replace` and then fails with
`InvalidOperationException: Sequence contains more than one element`.
3. **Deploy graphs skip the validator.** It was only `RequiredBySteps =
[Build, Publish]`. Azure Container Apps and App Service select a
resource's `BuildCompute` steps directly, so `build-{name}` never
depended on the validator.

### Fix

This is the same shape #21186 merged for Go and Python:
- Register the step through `builder.Pipeline.AddStep`, so it's no
longer a container annotation that `WithDockerfile` can replace.
- Skip validation when
`containerBuilder.Resource.IsExcludedFromPublish()`.
- Make the container's `BuildCompute` steps depend on the validation
step through `WithPipelineConfiguration`.

The existing test
`PublishPipelineWithExistingDockerfileThrowsFromValidationStepWhenRunScriptNameIsExplicit`
built a bare `new DistributedApplicationPipeline()`, which doesn't
contain steps added through `builder.Pipeline`. It now resolves the
app's `IDistributedApplicationPipeline`, as the Go and Python tests in
#21186 do. Its assertions are unchanged.

Not in this PR (remaining #21205 items): the Next.js standalone check's
`BuildCompute` dependency and a shared helper across Go, Python and
JavaScript.

### Before/after (local)

| Test | Before (`main` source) | After |
|---|---|---|
| `PublishPipelineValidationStepIsNoOpForResourceExcludedFromManifest` |
❌ `DistributedApplicationException: JavaScript app resource 'js' is
configured to run script 'migrate' ...` | ✅ |
| `PublishPipelineValidationStepSurvivesLaterWithDockerfile` | ❌
`InvalidOperationException: Sequence contains more than one element`
(from `WithDockerfile`) | ✅ |
| `PublishPipelineRunsValidationStepBeforeImageBuildStep` | ❌
`Assert.Contains() Failure: Filter not matched` (validator not in the
`build-js` closure) | ✅ |

- The four `*PublishPipeline*` tests pass in 20/20 repeated runs.
- Full `Aspire.Hosting.JavaScript.Tests`: 408/427 pass locally. The 19
failures are environmental and unrelated:
- Bun and Deno functional tests fail in 0ms because those tools aren't
installed.
- Verify snapshot tests fail because the sandbox HOME is `/root`, which
the scrubber rewrites inside `/root/.cache`. With a different HOME, all
101 snapshot tests pass.

## Checklist

- Is this feature complete?
  - [ ] Yes. Ready to ship.
  - [x] No. Follow-up changes expected.
- Are you including unit tests for the changes and scenario tests if
relevant?
  - [x] 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
  - [x] 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
  - [x] No

**🤖 Posted by AspireAgent (AI Agent)**

---------

Co-authored-by: davidfowl <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: David Pine <[email protected]>
Co-authored-by: IEvangelist <[email protected]>
(cherry picked from commit 059be63)
Mitch Denny (mitchdenny) pushed a commit that referenced this pull request Nov 10, 2026
…ipeline registration (#21461)

## Description

Part of #21205. Aligns the JavaScript existing-Dockerfile run-script
validator (`validate-javascript-dockerfile-run-script-{name}`) with the
Go and Python validators fixed in #21186.

### Bugs on `main`, each reproduced by a new test

1. **Excluded resources still fail publish.** A JavaScript app with an
existing Dockerfile and an explicit run script that is marked
`ExcludeFromManifest()` still runs the validator and throws `JavaScript
app resource 'js' is configured to run script 'migrate', but publish is
using the existing Dockerfile ...`. The resource isn't published at all,
so this failure is spurious.
2. **`PublishAsDockerFile(c => c.WithDockerfile(...))` crashes in
publish mode.** The validator was a second `PipelineStepAnnotation` on
the container. `WithDockerfile` calls
`EnsureBuildAndPushPipelineAnnotations`, which adds its annotation with
`ResourceAnnotationMutationBehavior.Replace` and then fails with
`InvalidOperationException: Sequence contains more than one element`.
3. **Deploy graphs skip the validator.** It was only `RequiredBySteps =
[Build, Publish]`. Azure Container Apps and App Service select a
resource's `BuildCompute` steps directly, so `build-{name}` never
depended on the validator.

### Fix

This is the same shape #21186 merged for Go and Python:
- Register the step through `builder.Pipeline.AddStep`, so it's no
longer a container annotation that `WithDockerfile` can replace.
- Skip validation when
`containerBuilder.Resource.IsExcludedFromPublish()`.
- Make the container's `BuildCompute` steps depend on the validation
step through `WithPipelineConfiguration`.

The existing test
`PublishPipelineWithExistingDockerfileThrowsFromValidationStepWhenRunScriptNameIsExplicit`
built a bare `new DistributedApplicationPipeline()`, which doesn't
contain steps added through `builder.Pipeline`. It now resolves the
app's `IDistributedApplicationPipeline`, as the Go and Python tests in
#21186 do. Its assertions are unchanged.

Not in this PR (remaining #21205 items): the Next.js standalone check's
`BuildCompute` dependency and a shared helper across Go, Python and
JavaScript.

### Before/after (local)

| Test | Before (`main` source) | After |
|---|---|---|
| `PublishPipelineValidationStepIsNoOpForResourceExcludedFromManifest` |
❌ `DistributedApplicationException: JavaScript app resource 'js' is
configured to run script 'migrate' ...` | ✅ |
| `PublishPipelineValidationStepSurvivesLaterWithDockerfile` | ❌
`InvalidOperationException: Sequence contains more than one element`
(from `WithDockerfile`) | ✅ |
| `PublishPipelineRunsValidationStepBeforeImageBuildStep` | ❌
`Assert.Contains() Failure: Filter not matched` (validator not in the
`build-js` closure) | ✅ |

- The four `*PublishPipeline*` tests pass in 20/20 repeated runs.
- Full `Aspire.Hosting.JavaScript.Tests`: 408/427 pass locally. The 19
failures are environmental and unrelated:
- Bun and Deno functional tests fail in 0ms because those tools aren't
installed.
- Verify snapshot tests fail because the sandbox HOME is `/root`, which
the scrubber rewrites inside `/root/.cache`. With a different HOME, all
101 snapshot tests pass.

## Checklist

- Is this feature complete?
  - [ ] Yes. Ready to ship.
  - [x] No. Follow-up changes expected.
- Are you including unit tests for the changes and scenario tests if
relevant?
  - [x] 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
  - [x] 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
  - [x] No

**🤖 Posted by AspireAgent (AI Agent)**

---------

Co-authored-by: davidfowl <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: David Pine <[email protected]>
Co-authored-by: IEvangelist <[email protected]>
(cherry picked from commit 059be63)
Eric Erhardt (eerhardt) pushed a commit to microsoft/aspire.dev that referenced this pull request Nov 16, 2026
…thon (#1979)

Documents changes from microsoft/aspire#21186

Author: ``@IEvangelist-reviewed`` source PR author per source PR
metadata (see source PR).

Targeting `release/17.0` based on the source PR milestone `17.0`
(`exact_match`).

## Why
Publishing a Go or Python app with its own `Dockerfile` previously
ignored the resource's entrypoint silently. Go now logs a warning when
`packagePath` isn't the app directory; Python now fails when
`WithEntrypoint(...)` changes the entrypoint. Docs didn't describe this.

## Changes (updated pages)
- `src/frontend/src/content/docs/integrations/frameworks/python.mdx`:
new "Use an existing Dockerfile" section.
-
`src/frontend/src/content/docs/integrations/frameworks/go/go-host.mdx`:
new "Use an existing Dockerfile" section under Publish Go apps.

Triggered signal: `pr_body_has_cli_flag_mention` (`--publisher manifest`
note).

> Generated by [PR Documentation
Check](https://github.com/microsoft/aspire/actions/runs/40914589241) for
#21186 · copilot · auto · 27.5 AIC · ⌖ 1.15 AIC · ⊞ 7.1K ·
[◷](https://github.com/search?q=repo%3Amicrosoft%2Faspire.dev+%22gh-aw-workflow-id%3A+pr-docs-check%22&type=pullrequests)

<!-- gh-aw-agentic-workflow: PR Documentation Check, engine: copilot,
model: auto, id: 40914589241, workflow_id: pr-docs-check, run:
https://github.com/microsoft/aspire/actions/runs/40914589241 -->

<!-- gh-aw-workflow-id: pr-docs-check -->
<!-- gh-aw-workflow-call-id: microsoft/aspire/pr-docs-check -->

Co-authored-by: aspire-repo-bot[bot] <268009190+aspire-repo-bot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-integrations Issues pertaining to Aspire Integrations packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Publishing a Go/Python app with a user-supplied Dockerfile silently drops the tool-invocation prefix

5 participants