Skip to content

Fix multi-arch container label parsing#55414

Merged
baronfel merged 1 commit into
dotnet:mainfrom
jetersen:fix/multiarch-container-label-parsing
Jul 23, 2026
Merged

Fix multi-arch container label parsing#55414
baronfel merged 1 commit into
dotnet:mainfrom
jetersen:fix/multiarch-container-label-parsing

Conversation

@jetersen

Copy link
Copy Markdown
Contributor

Summary

  • split serialized multi-architecture container labels only on the first colon
  • preserve URLs, RFC 3339 timestamps, and other values containing colons
  • add regression coverage for source and creation-time labels

Root cause

Multi-architecture inner builds receive labels serialized as key:value. _ParseItemsForPublishingSingleContainer used an unrestricted Split(':') and selected element 1, truncating everything after the next colon.

Fixes #52732.

Validation

  • containers.slnf builds successfully with zero warnings or errors
  • focused integration test project builds
  • direct MSBuild execution of _ParseItemsForPublishingSingleContainer preserves both URL and RFC 3339 values

The repository test runner requires a built redist SDK; the attempted redist build was blocked by an unrelated missing project.assets.json in the Static Web Assets tool chain.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
2 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@jetersen
jetersen marked this pull request as ready for review July 22, 2026 17:46
@jetersen
jetersen requested a review from a team as a code owner July 22, 2026 17:46
Copilot AI review requested due to automatic review settings July 22, 2026 17:46
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
2 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

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.

Pull request overview

This PR fixes parsing of multi-architecture container labels that are serialized as key:value when passed to inner builds. The existing MSBuild target split on all colons and truncated label values containing colons (e.g., https://... URLs and RFC 3339 timestamps), producing incorrect OCI label metadata.

Changes:

  • Update _ParseItemsForPublishingSingleContainer to split label entries only on the first colon (Split(':', 2)), preserving the remainder of the value.
  • Add an integration regression test ensuring multi-arch label values containing colons (URL + timestamp) round-trip correctly.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
test/Microsoft.NET.Build.Containers.IntegrationTests/TargetsTests.cs Adds regression coverage validating that multi-arch label parsing preserves colons in values.
src/Containers/packaging/build/Microsoft.NET.Build.Containers.targets Fixes label parsing by limiting the split to two parts (key + remainder value).

@jetersen

Copy link
Copy Markdown
Contributor Author

@dotnet-policy-service agree

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

Thanks for sending this!

@baronfel baronfel added the Area-Containers Related to dotnet SDK containers functionality label Jul 22, 2026
@baronfel baronfel added this to the 11.0.1xx milestone Jul 22, 2026
@baronfel
baronfel merged commit 360efc5 into dotnet:main Jul 23, 2026
31 checks passed
@baronfel

Copy link
Copy Markdown
Member

/backport to release/11.0.1xx-preview7

@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/11.0.1xx-preview7 (link to workflow run)

@baronfel

Copy link
Copy Markdown
Member

@jetersen this will be in RC1 in September for sure, but am backporting to the p7 branch so you can hopefully see it in p7 too!

@jetersen

Copy link
Copy Markdown
Contributor Author

@baronfel yes! That's sounds great 👏

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

Labels

Area-Containers Related to dotnet SDK containers functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OCI Metadata Labels Broken When Using Hyperlinks

3 participants