Repository navigation
[release/17.0] Align JavaScript Dockerfile run-script validator with Go and Python pipeline registration - #22006
Closed
Mitch Denny (mitchdenny) wants to merge 1 commit into
Conversation
…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 <95136+davidfowl@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: David Pine <david.pine@microsoft.com> Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> (cherry picked from commit 059be63)
14 tasks
This comment has been minimized.
This comment has been minimized.
Mitch Denny (mitchdenny)
force-pushed
the
mitchdenny-backport-17-0-09-pr21461
branch
2 times, most recently
from
November 10, 2026 04:24
a9aa67e to
47b917e
Compare
Contributor
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 22006Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 22006" |
Mitch Denny (mitchdenny)
marked this pull request as ready for review
November 10, 2026 04:30
Member
Author
|
Approved for inclusion in release/17.0. Do not merge yet. |
Mitch Denny (mitchdenny)
force-pushed
the
mitchdenny-backport-17-0-09-pr21461
branch
from
November 10, 2026 05:30
47b917e to
4827f31
Compare
This comment has been minimized.
This comment has been minimized.
Contributor
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
Mitch Denny (mitchdenny)
force-pushed
the
mitchdenny-backport-17-0-09-pr21461
branch
from
November 10, 2026 07:05
4827f31 to
47b917e
Compare
Mitch Denny (mitchdenny)
force-pushed
the
mitchdenny-backport-17-0-09-pr21461
branch
from
November 10, 2026 07:14
47b917e to
4827f31
Compare
Mitch Denny (mitchdenny)
force-pushed
the
mitchdenny-backport-17-0-09-pr21461
branch
from
November 10, 2026 09:16
4827f31 to
47b917e
Compare
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
Backport of #21461 to
release/17.0(cherry-picked from 059be63 with no modifications). Layer 9 of 55 in the release/17.0 backport stack; stacked on #22005.Backport recommendation: Yes — Fixes spurious publish failures and a crash in the JS Dockerfile validator.
Backport of #21461
Checklist
<remarks />and<code />elements on your triple slash comments?