-
Notifications
You must be signed in to change notification settings - Fork 770
Add buildOnly field to manifest schema and infrastructure #12696
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for build-only containers and container file sharing in the Aspire manifest. Build-only containers are containers that produce artifacts for other containers but don't run as services themselves.
Key Changes:
- Added
buildOnlyproperty to the manifest schema for containers without entrypoints - Added
containerFilesproperty to the schema for specifying file dependencies between containers - Updated manifest publishing to write
buildOnly: truewhen a container has no entrypoint - Added new method to serialize container file destination annotations to the manifest
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/Schema/aspire-8.0.json | Added schema definitions for buildOnly and containerFiles properties across container, project, and executable resource types |
| src/Aspire.Hosting/Publishing/ManifestPublishingContext.cs | Implemented WriteContainerFilesDestination method and integrated buildOnly flag into manifest generation |
| tests/Aspire.Hosting.Tests/PublishAsDockerfileTests.cs | Updated test expectations to include buildOnly: true for containers published as Dockerfiles |
| tests/Aspire.Hosting.JavaScript.Tests/AddViteAppTests.cs | Updated test expectations to include buildOnly: true for Vite app containers |
The issue was that JavaScript apps using PublishAsDockerFile() were not setting HasEntrypoint=false on the correct annotation. The fix required setting it after WithDockerfileBuilder() since that method creates a new DockerfileBuildAnnotation that replaces the original one. Co-authored-by: vhvb1989 <[email protected]>
As requested in code review, reverting changes to JavaScriptHostingExtensions.cs. The manifest publisher should describe current API behavior without modifying the APIs. Co-authored-by: vhvb1989 <[email protected]>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 12696Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 12696" |
|
@copilot update the hosting tests |
Added three comprehensive tests for the containerFiles feature: - Single source with single destination - Single source with multiple source paths - Multiple sources with multiple destinations All tests verify that containerFiles are correctly serialized to the manifest JSON. Co-authored-by: vhvb1989 <[email protected]>
This was harder to fix... The initial expectation was that IMO, folks should be able to call |
eerhardt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
/backport to release/13.0 |
|
Started backporting to release/13.0: https://github.com/dotnet/aspire/actions/runs/19115095512 |
Adds support for the
buildOnlyfield in the Aspire manifest schema and publishing infrastructure to enable future identification of build-only containers.Changes
Manifest Schema (
src/Schema/aspire-8.0.json)buildOnlyproperty definition for containers without entrypointscontainerFilesproperty for specifying file dependencies between containersManifest Publishing (
src/Aspire.Hosting/Publishing/ManifestPublishingContext.cs)WriteBuildContextAsyncto writebuildOnly: truewhen a container has no entrypoint (!annotation.HasEntrypoint)WriteContainerFilesDestinationmethod to serialize container file destination annotationsTests
PublishAsDockerfileTests.csto reflect current behavior (buildOnly not written for JavaScript apps)AddViteAppTests.csverified for Vite app containerscontainerFilesmanifest serialization inManifestGenerationTests.cs:ContainerFilesAreWrittenToManifest- tests single source with single destinationContainerFilesWithMultipleSourcesAreWrittenToManifest- tests single source with multiple source pathsContainerFilesWithMultipleDestinationsAreWrittenToManifest- tests multiple sources with multiple destinationsScope
This PR adds the infrastructure for the
buildOnlyfield in the manifest. The manifest publisher will writebuildOnly: truewhen a container has aDockerfileBuildAnnotationANDHasEntrypointis set tofalse.Currently, JavaScript apps using
PublishAsDockerFile()do not setHasEntrypoint = false, so the field is not written in practice. The schema and publishing infrastructure are in place to support this feature when resources properly configure their entrypoint status.The
containerFilesfeature is fully tested with comprehensive test coverage validating that container file source-to-destination mappings are correctly serialized to the manifest JSON.No changes were made to existing APIs - only the manifest schema and serialization infrastructure were updated to support the buildOnly field and containerFiles feature.
Created from VS Code via the GitHub Pull Request extension.
Original prompt
Created from VS Code via the GitHub Pull Request extension.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.