Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 5, 2025

Adds support for the buildOnly field 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)

  • Added buildOnly property definition for containers without entrypoints
  • Added containerFiles property for specifying file dependencies between containers

Manifest Publishing (src/Aspire.Hosting/Publishing/ManifestPublishingContext.cs)

  • Updated WriteBuildContextAsync to write buildOnly: true when a container has no entrypoint (!annotation.HasEntrypoint)
  • Added WriteContainerFilesDestination method to serialize container file destination annotations

Tests

  • Updated test expectations in PublishAsDockerfileTests.cs to reflect current behavior (buildOnly not written for JavaScript apps)
  • Test expectations in AddViteAppTests.cs verified for Vite app containers
  • Added 3 comprehensive tests for containerFiles manifest serialization in ManifestGenerationTests.cs:
    • ContainerFilesAreWrittenToManifest - tests single source with single destination
    • ContainerFilesWithMultipleSourcesAreWrittenToManifest - tests single source with multiple source paths
    • ContainerFilesWithMultipleDestinationsAreWrittenToManifest - tests multiple sources with multiple destinations

Scope

This PR adds the infrastructure for the buildOnly field in the manifest. The manifest publisher will write buildOnly: true when a container has a DockerfileBuildAnnotation AND HasEntrypoint is set to false.

Currently, JavaScript apps using PublishAsDockerFile() do not set HasEntrypoint = 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 containerFiles feature 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

implement this.

Summary of Conversation History

Recent Agent Commands and Tool Results

  1. User Request: The user requested to run tests for the manifest generation and ensure all tests pass, mentioning that there might be some snapshots to be updated after the change for adding new fields.

  2. Agent Response: The agent acknowledged the request but did not execute any specific commands or tools at that moment.

  3. User Request: The user then prompted the agent to "Continue: 'Continue to iterate?'" indicating a desire to proceed with the implementation of the changes discussed earlier.

  4. Agent Response: The agent noted that there had been changes between the last request and the current state, suggesting that some edits were made, possibly by a formatter or another automated tool.

  5. User Request: The user reiterated the request to implement the changes.

Results from Recent Tool Calls

  • No specific tool calls were executed in the most recent interactions, but the context indicated that the agent was expected to run tests related to the manifest generation and ensure that all tests pass.

Active Work When Token Budget Exceeded

  • The agent was actively working on implementing changes related to the manifest generation, specifically adding new fields to the manifest for resources that are only for build but not for deploy. This included ensuring that the build section of projects and containers in the manifest correctly reflected whether resources were build-only.

Connection to Overall User Goals

  • The user's overall goal appears to be enhancing the functionality of the Aspire framework, particularly in how it generates manifests for various resources. The recent requests focused on ensuring that the manifest accurately describes the resources, including those that are only built and not deployed, and ensuring that the testing framework validates these changes effectively. The user is looking to ensure that the implementation is robust and that all related tests pass, indicating a focus on quality and reliability in the deployment process.
    TITLE: Adding buildOnly field to manifest for resources

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.

@vhvb1989 vhvb1989 requested a review from davidfowl November 5, 2025 04:59
@vhvb1989 vhvb1989 marked this pull request as ready for review November 5, 2025 05:08
@vhvb1989 vhvb1989 requested a review from mitchdenny as a code owner November 5, 2025 05:08
Copilot AI review requested due to automatic review settings November 5, 2025 05:08
Copy link
Contributor

Copilot AI left a 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 buildOnly property to the manifest schema for containers without entrypoints
  • Added containerFiles property to the schema for specifying file dependencies between containers
  • Updated manifest publishing to write buildOnly: true when 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]>
Copilot AI changed the title [WIP] Run tests for manifest generation and update snapshots Fix buildOnly field not being written to manifest for JavaScript apps Nov 5, 2025
Copilot AI requested a review from vhvb1989 November 5, 2025 05:31
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]>
Copilot AI changed the title Fix buildOnly field not being written to manifest for JavaScript apps Add buildOnly field to manifest for build-only containers Nov 5, 2025
Copilot AI requested a review from vhvb1989 November 5, 2025 06:33
@github-actions
Copy link
Contributor

github-actions bot commented Nov 5, 2025

🚀 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/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 12696

Or

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

@davidfowl
Copy link
Member

@copilot update the hosting tests

Copy link
Contributor Author

Copilot AI commented Nov 5, 2025

@copilot update the hosting tests

Updated in commit 71eba94. Removed buildOnly: true from test expectations in PublishAsDockerfileTests since the current behavior doesn't set HasEntrypoint = false for JavaScript apps with existing Dockerfiles. All 13 tests now passing.

Copilot AI changed the title Add buildOnly field to manifest for build-only containers Add buildOnly field to manifest schema and infrastructure Nov 5, 2025
Copilot AI requested a review from davidfowl November 5, 2025 07:52
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]>
@vhvb1989
Copy link
Contributor

vhvb1989 commented Nov 5, 2025

@copilot update the hosting tests

This was harder to fix... The initial expectation was that AddJavaScriptApp() would generate a resource with buildOnly: true if it was not explicitly annotated with PublishAsDockerFile(). But this is not expected in the actual design. The tradeoff is that only AddViteApp() is currently build-only. AddJavaScriptApp() is automatically calling PublishAsDockerFile() internally, making the resource deployable

IMO, folks should be able to call AddJavaScriptApp(...) and decide if it is buildOnly or not. Specially because it can be used as source to build other services.

Copy link
Member

@eerhardt eerhardt left a comment

Choose a reason for hiding this comment

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

LGTM

@eerhardt eerhardt merged commit 1e56a3f into main Nov 5, 2025
301 of 303 checks passed
@eerhardt eerhardt deleted the copilot/vscode1762318692431 branch November 5, 2025 20:17
@eerhardt
Copy link
Member

eerhardt commented Nov 5, 2025

/backport to release/13.0

@dotnet-policy-service dotnet-policy-service bot added this to the 13.1 milestone Nov 5, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Nov 5, 2025

Started backporting to release/13.0: https://github.com/dotnet/aspire/actions/runs/19115095512

@github-actions github-actions bot locked and limited conversation to collaborators Dec 6, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants