Skip to content

OCI Metadata Labels Broken When Using Hyperlinks #52732

@mu88

Description

@mu88

Describe the bug

Hey @baronfel,

Please refer to this discussion: when using the .NET SDK Container Building Tools and using hyperlinks, this breaks the OCI metadata labels.

For example, please see this image manifest of a container image built using the .NET SDK Container Building Tools:

{
  // remainder left out for brevity
  "labels": {
    "org.opencontainers.image.source": "https",
    "com.docker.extension.changelog": "https",
    "org.opencontainers.image.url": "https",
    "org.opencontainers.image.licenses": "https",
    "org.opencontainers.image.documentation": "https",
    "com.docker.extension.publisher-url": "https",
  }
}

But I properly ensured via some MSBuild output on GitHub Actions that the necessary properties are present:

GITHUB_REPOSITORY_OWNER: 'mu88'
GITHUB_SERVER_URL: 'https://github.com'
GITHUB_REPOSITORY: 'mu88/RaspiFanController'
GITHUB_SHA: '0780e22d89107421e164448d2f249d8a8c5e27ff'
ContainerAuthors: 'mu88'
ContainerDocumentationUrl: 'https://github.com/mu88/RaspiFanController/blob/0780e22d89107421e164448d2f249d8a8c5e27ff/README.md'
ContainerInformationUrl: 'https://github.com/mu88/pkgs/container/RaspiFanController'
ContainerLicenseExpression: 'https://github.com/mu88/blob/0780e22d89107421e164448d2f249d8a8c5e27ff/LICENSE.md'
ContainerRepository: 'mu88/RaspiFanController'
ContainerTitle: 'mu88/RaspiFanController'
ContainerVendor: 'mu88'
ContainerVersion: '0780e22d89107421e164448d2f249d8a8c5e27ff'

To Reproduce

  1. Create a new .NET project.
  2. Publish a multi-arch Docker image via dotnet publish /t:PublishContainer /p:RuntimeIdentifiers=linux-x64;linux-arm64 /p:ContainerDocumentationUrl=https://dot.net.
  3. Inspect the OCI metadata labels of the built image - you will see that the hyperlink is broken and only contains https.

Exceptions (if any)

No exceptions

Further technical details

details of dotnet --info

.NET SDK: Version: 10.0.102 Commit: 4452502459 Workload version: 10.0.100-manifests.6d969a7e MSBuild version: 18.0.7+445250245

Runtime Environment:
OS Name: Windows
OS Version: 10.0.26100
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\10.0.102\

.NET workloads installed:
[maui-windows]
Installation Source: VS 18.2.11415.280
Manifest Version: 10.0.1/10.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\10.0.100\microsoft.net.sdk.maui\10.0.1\WorkloadManifest.json
Install Type: Msi

[maccatalyst]
Installation Source: VS 18.2.11415.280
Manifest Version: 26.1.10502/10.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\10.0.100\microsoft.net.sdk.maccatalyst\26.1.10502\WorkloadManifest.json
Install Type: Msi

[ios]
Installation Source: VS 18.2.11415.280
Manifest Version: 26.1.10502/10.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\10.0.100\microsoft.net.sdk.ios\26.1.10502\WorkloadManifest.json
Install Type: Msi

[android]
Installation Source: VS 18.2.11415.280
Manifest Version: 36.1.2/10.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\10.0.100\microsoft.net.sdk.android\36.1.2\WorkloadManifest.json
Install Type: Msi

Configured to use workload sets when installing new manifests.
No workload sets are installed. Run "dotnet workload restore" to install a workload set.

Host:
Version: 10.0.2
Architecture: x64
Commit: 4452502459

.NET SDKs installed:
2.1.700 [C:\Program Files\dotnet\sdk]
2.2.300 [C:\Program Files\dotnet\sdk]
8.0.417 [C:\Program Files\dotnet\sdk]
9.0.305 [C:\Program Files\dotnet\sdk]
10.0.100 [C:\Program Files\dotnet\sdk]
10.0.102 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.All 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 10.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 10.0.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.23 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 10.0.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.23 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.12 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 10.0.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
DOTNET_CLI_TELEMETRY_OPTOUT [true]
DOTNET_UPGRADEASSISTANT_TELEMETRY_OPTOUT [1]

global.json file:
Not found

Learn more:
https://aka.ms/dotnet/info

Download .NET:
https://aka.ms/dotnet/download

I think that this is the culprit: when calling "org.opencontainers.image.documentation:https://dot.net".Split(':')[1], this will only return https, because due to the trailing colon, the remainder will be put into the split array's third bucket / [2].
Maybe the solution could be using .Split(':', 2)[1] instead of .Split(':')[1], hereby putting everything after the very first colon (i.e. the hyperlink) into the second bucket / [1].

Please also refer to this MSBuild bin log created during a GitHub Actions run and the following screenshots:

Image Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    untriagedRequest triage from a team member

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions