Skip to content

[release/17.0] Make layered .NET container archives match SDK archive output - #22672

Merged
Jose Perez Rodriguez (joperezr) merged 3 commits into
release/17.0from
backport/pr-22666-to-release/17.0
Nov 26, 2026
Merged

Jose Perez Rodriguez (joperezr) merged 3 commits into
release/17.0from
backport/pr-22666-to-release/17.0

Conversation

@aspire-repo-bot

@aspire-repo-bot aspire-repo-bot Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Backport of #22666 to release/17.0

/cc Eric Erhardt (@eerhardt)

Differs from main: this backport keeps the .NET SDK's <repository>.tar.gz file name for a directory OutputPath, so it is not a breaking change in 17.0.x. The <image>.tar rename and name flattening (labeled breaking-change in #22666) ship only in main. Because the default directory name ends in .tar.gz, the uncompressed-archive warning fires only for explicitly chosen .gz/.tgz file names.

Customer Impact

Customers who publish a .NET project to an image archive (Destination = ContainerImageDestination.Archive) and also use PublishWithContainerFiles (for example, to copy a Vite frontend into wwwroot) get a different archive than without container files, so tools that consume it break (#22591):

  • ImageFormat = Oci fails on Docker with "Docker cannot export an OCI archive...", even though Docker Engine 25+ writes OCI layouts.
  • A directory OutputPath produces <name>-<tag>.tar instead of the SDK's <name>.tar.gz.
  • An explicit .tar.gz path is gzip-compressed only when layered, so OCI-layout tools such as oras cp --from-oci-layout fail with invalid tar header.

Separately, ContainerImageReference returned a nonexistent <name>-<tag>.tar path for .NET projects with a directory OutputPath, even without container files.

Testing

Unit tests added or updated in DockerContainerRuntimeTests, DotnetProgramArchiveTests, DotnetProgramPublishingTests, and ResourceContainerImageManagerTests cover OCI save on Docker, layered and non-layered builds resolving to the same <repository>.tar.gz path, uncompressed output, existing dotted directories, and the .gz warning.

On the backport branch, the 198 targeted Aspire.Hosting.Tests pass. The full Aspire.Hosting.Dotnet.Tests suite has 498 passing; 5 real-container tests there and 2 Dockerfile-build tests in Aspire.Hosting.Tests couldn't run locally because Docker wasn't running. They passed with Docker on the main PR (#22666). Manually verified that docker image save on Docker 29.9.3 writes oci-layout and index.json.

Risk

Low. The change is limited to .NET project archive publishing (Destination = Archive), with no public API changes. Archives from builds without container files keep 17.0's file name and format. Layered archives change name and compression to match the SDK, which is the bug fix. Explicit .gz/.tgz file names now log a warning.

Regression?

No. The OCI rejection, the layered naming, and the gzip behavior are all present in 13.6.5 (introduced with #19997).

PublishWithContainerFiles archives now support OCI on Docker 25+, use the SDK's
<name>.tar.gz directory naming, and are written as uncompressed tar like the SDK.

Fixes #22591

Co-authored-by: Copilot App <[email protected]>
…sions

Aspire now resolves a directory OutputPath to <flattened-image-name>.tar and
passes the SDK an explicit archive file, so SDK-only and layered publishing write
the same file regardless of the SDK's own path rules. Existing directories stay
directories. Explicit .gz/.tgz archive names log a warning because the archive is
an uncompressed tar.

Co-authored-by: Copilot App <[email protected]>
@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 -- 22672

Or

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

@github-actions github-actions Bot added the area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication label Nov 25, 2026
@github-actions

This comment has been minimized.

Servicing keeps the existing directory OutputPath file name so this backport is
not a breaking change. Only explicitly chosen .gz/.tgz archive names log the
uncompressed-tar warning, since the default directory name ends in .tar.gz.

Co-authored-by: Copilot App <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

Tests selector

52 / 101 PR test projects · 4 PR jobs, from 8 changed files.

Selected PR test projects (52 / 101)

Aspire.Cli.EndToEnd.Tests, Aspire.Hosting.Analyzers.Tests, Aspire.Hosting.Azure.EntraId.Tests, Aspire.Hosting.Azure.Kubernetes.Tests, Aspire.Hosting.Azure.Kusto.Tests, Aspire.Hosting.Azure.Provisioning.Tests, Aspire.Hosting.Azure.Tests, Aspire.Hosting.Blazor.Tests, Aspire.Hosting.Browsers.Tests, Aspire.Hosting.CodeGeneration.Go.Tests, Aspire.Hosting.CodeGeneration.Java.Tests, Aspire.Hosting.CodeGeneration.Python.Tests, Aspire.Hosting.CodeGeneration.Rust.Tests, Aspire.Hosting.CodeGeneration.TypeScript.Tests, Aspire.Hosting.Containers.Tests, Aspire.Hosting.DevTunnels.Tests, Aspire.Hosting.Docker.Tests, Aspire.Hosting.Dotnet.Tests, Aspire.Hosting.DotnetTool.Tests, Aspire.Hosting.EntityFrameworkCore.Tests, Aspire.Hosting.Foundry.Tests, Aspire.Hosting.Garnet.Tests, Aspire.Hosting.Go.Tests, Aspire.Hosting.Java.Tests, Aspire.Hosting.JavaScript.Tests, Aspire.Hosting.Kafka.Tests, Aspire.Hosting.Keycloak.Tests, Aspire.Hosting.Kubernetes.Tests, Aspire.Hosting.Maui.Tests, Aspire.Hosting.Milvus.Tests, Aspire.Hosting.MongoDB.Tests, Aspire.Hosting.MySql.Tests, Aspire.Hosting.Nats.Tests, Aspire.Hosting.OpenAI.Tests, Aspire.Hosting.Oracle.Tests, Aspire.Hosting.Orleans.Tests, Aspire.Hosting.PostgreSQL.Tests, Aspire.Hosting.Python.Tests, Aspire.Hosting.Qdrant.Tests, Aspire.Hosting.RabbitMQ.Tests, Aspire.Hosting.Radius.Tests, Aspire.Hosting.Redis.Tests, Aspire.Hosting.RemoteHost.Tests, Aspire.Hosting.Rust.Tests, Aspire.Hosting.Seq.Tests, Aspire.Hosting.SqlServer.Tests, Aspire.Hosting.Testing.Tests, Aspire.Hosting.Tests, Aspire.Hosting.Valkey.Tests, Aspire.Hosting.Yarp.Tests, Aspire.Playground.Tests, Aspire.Templates.Tests

Selected PR jobs (4)

cli-starter-validation, extension-e2e, polyglot, typescript-api-compat


How these were chosen — grouped by what changed

⚠️ 46 of the 52 selected test projects come from a single change — src/Aspire.Hosting/ApplicationModel/ContainerImageReference.cs.

🔧 src/Aspire.Hosting/ApplicationModel/ContainerImageReference.cs (changed source)
→ 46 via the project graph

show 46

Aspire.Hosting.Analyzers.Tests (2 hops), Aspire.Hosting.Azure.EntraId.Tests (2 hops), Aspire.Hosting.Azure.Kubernetes.Tests (2 hops), Aspire.Hosting.Azure.Kusto.Tests (2 hops), Aspire.Hosting.Azure.Provisioning.Tests (3 hops), Aspire.Hosting.Azure.Tests, Aspire.Hosting.Browsers.Tests (2 hops), Aspire.Hosting.CodeGeneration.Go.Tests, Aspire.Hosting.CodeGeneration.Java.Tests, Aspire.Hosting.CodeGeneration.Python.Tests, Aspire.Hosting.CodeGeneration.Rust.Tests, Aspire.Hosting.CodeGeneration.TypeScript.Tests, Aspire.Hosting.Containers.Tests (2 hops), Aspire.Hosting.DevTunnels.Tests (2 hops), Aspire.Hosting.Docker.Tests (2 hops), Aspire.Hosting.DotnetTool.Tests (2 hops), Aspire.Hosting.EntityFrameworkCore.Tests (2 hops), Aspire.Hosting.Foundry.Tests (2 hops), Aspire.Hosting.Garnet.Tests (2 hops), Aspire.Hosting.Go.Tests (2 hops), Aspire.Hosting.Java.Tests (2 hops), Aspire.Hosting.JavaScript.Tests (2 hops), Aspire.Hosting.Kafka.Tests (2 hops), Aspire.Hosting.Keycloak.Tests (2 hops), Aspire.Hosting.Kubernetes.Tests (2 hops), Aspire.Hosting.Maui.Tests, Aspire.Hosting.Milvus.Tests (2 hops), Aspire.Hosting.MongoDB.Tests (2 hops), Aspire.Hosting.MySql.Tests (2 hops), Aspire.Hosting.Nats.Tests (2 hops), Aspire.Hosting.OpenAI.Tests (2 hops), Aspire.Hosting.Oracle.Tests (2 hops), Aspire.Hosting.Orleans.Tests (2 hops), Aspire.Hosting.PostgreSQL.Tests (2 hops), Aspire.Hosting.Python.Tests (2 hops), Aspire.Hosting.Qdrant.Tests (2 hops), Aspire.Hosting.RabbitMQ.Tests (2 hops), Aspire.Hosting.Redis.Tests (2 hops), Aspire.Hosting.RemoteHost.Tests, Aspire.Hosting.Rust.Tests (2 hops), Aspire.Hosting.Seq.Tests (2 hops), Aspire.Hosting.SqlServer.Tests (2 hops), Aspire.Hosting.Testing.Tests (2 hops), Aspire.Hosting.Valkey.Tests (2 hops), Aspire.Hosting.Yarp.Tests (2 hops), Aspire.Playground.Tests

🧪 tests/Aspire.Hosting.Tests/DotnetProgramPublishingTests.cs (changed test)
→ 1 directly: Aspire.Hosting.Tests
→ 3 via the project graph: Aspire.Hosting.Blazor.Tests, Aspire.Hosting.Dotnet.Tests, Aspire.Hosting.Radius.Tests

📦 affected project Aspire.Hosting.Dotnet
→ 2 tests: Aspire.Cli.EndToEnd.Tests, Aspire.Templates.Tests

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

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

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

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

Job reasons

Job Triggered by
cli-starter-validation affected project Aspire.Hosting.Dotnet
extension-e2e • src/Aspire.Hosting/ApplicationModel/ContainerImageReference.cs, src/Aspire.Hosting/ApplicationModel/DotnetProgramPublishing.cs, src/Aspire.Hosting/Publishing/DockerContainerRuntime.cs, src/Aspire.Hosting/Publishing/ResourceContainerImageManager.cs
• affected project Aspire.Hosting
polyglot • affected project Aspire.Hosting
• affected project Aspire.Hosting.Azure.Provisioning
typescript-api-compat affected project Aspire.Hosting

Selection computed for commit c26099f.

@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.

@mitchdenny Mitch Denny (mitchdenny) left a comment

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.

Would be good to get this into Aspire 17.0.1

@eerhardt

Eric Erhardt (eerhardt) commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

These are the 2 product code changes between #22666 and this PR:

Left is main, right is "this PR"

image image

@joperezr
Jose Perez Rodriguez (joperezr) merged commit 0298f3a into release/17.0 Nov 26, 2026
704 of 707 checks passed
@microsoft-github-policy-service microsoft-github-policy-service Bot added this to the 17.0 milestone Nov 26, 2026
@aspire-repo-bot

Copy link
Copy Markdown
Contributor Author

✅ No documentation update needed.

excluded → backport (exclusion_reasons: base_branch_is_release, head_branch_is_backport, title_release_prefix, body_backport_marker). This is a backport of #22666; docs belong with the forward PR. Triggered signals: integration_readme_changed (src/Aspire.Hosting.Dotnet/README.md), pr_body_has_breaking_change_marker, pr_body_has_cli_flag_mention.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants