Skip to content
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

[BUG] [ACR] Unable to create OCI manifest in Azure Container Registry #17084

Closed
sajayantony opened this issue Nov 19, 2020 · 2 comments
Closed
Assignees
Labels
Client This issue points to a problem in the data-plane of the library. Container Registry

Comments

@sajayantony
Copy link

Describe the bug
The SDK should enable the client to create an OCIManifest.

Expected behavior
CreateAsync on an OCIManifest succeeds.

Actual behavior (include Exception or Stack Trace)
Exception thrown with error code = "MANIFEST_INVALID"

To Reproduce
Steps to reproduce the behavior (include a code snippet, screenshot, or any additional information that might help us reproduce the issue)

using Microsoft.Azure.ContainerRegistry;
using Microsoft.Azure.ContainerRegistry.Models;
using Microsoft.Rest.Azure;
using System;
using System.Threading.Tasks;

namespace manifest_test
{
    class Program
    {
        static async Task Main(string[] args)
        {
            var login = "myregistry.azurecr.io";
            var username = "";
            var password = "";


            var client = new AzureContainerRegistryClient(
                new ContainerRegistryCredentials(
                    ContainerRegistryCredentials.LoginMode.Basic,
                    loginUrl: login,
                    username: username,
                    password: password));

            string OciManifestMediaType = "application/vnd.oci.image.manifest.v1+json";
            string V2ManifestMediaType = "application/vnd.docker.distribution.manifest.v2+json";

            var repo = "hello-world";
            var tag = "latest";
            var resp = await client.Manifests.GetAsync("hello-world", "latest", V2ManifestMediaType);
            client = new AzureContainerRegistryClient(
                           new ContainerRegistryCredentials(
                               ContainerRegistryCredentials.LoginMode.Basic,
                               loginUrl: login,
                               username: username,
                               password: password));

            V2Manifest v2Manifest = (V2Manifest)resp;
            OCIManifest manifest = new OCIManifest();
            manifest.Config = v2Manifest.Config;
            manifest.Config.MediaType = "application/vnd.oci.image.config.v1+json";
            manifest.Layers = v2Manifest.Layers;
            manifest.SchemaVersion = 2;

            // MediaType should be OciManifestMediaType
            await client.Manifests.CreateAsync(repo, "test-put-oci", manifest);

            //Throws exception with detail 
            /* 
             * 		Content	"{\"errors\":[{\"code\":\"MANIFEST_INVALID\",\"message\":\"manifest invalid\",\"detail\":{}}]}\n"	string
            */
        }
    }
}

Environment:

Project 'acr' has the following package references
   [net5.0]:
   Top-level Package                        Requested             Resolved
   > Azure.Identity                         1.2.3                 1.2.3
   > Microsoft.Azure.ContainerRegistry      0.10.0-preview        0.10.0-preview
   > Microsoft.Extensions.Hosting           3.1.9                 3.1.9
   > Newtonsoft.Json                        12.0.3                12.0.3
   > System.CommandLine                     2.0.0-beta1.20371.2   2.0.0-beta1.20371.2
   > System.CommandLine.Hosting             0.3.0-alpha.20371.2   0.3.0-alpha.20371.2
   > System.Text.Json                       4.7.1                 4.7.1
@ghost ghost added the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Nov 19, 2020
@adewaleo
Copy link
Contributor

Hmm, I don't remember concretely. but I think I also ran into this issue.

I think this might be the root cause
swagger hardcodes docker manifest mediatype
generated sdk overrides this mediatype

@yugangw-msft yugangw-msft self-assigned this Nov 19, 2020
@jsquire jsquire added Client This issue points to a problem in the data-plane of the library. Container Registry labels Nov 19, 2020
@ghost ghost removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Nov 19, 2020
@yugangw-msft
Copy link
Contributor

fixed

@github-actions github-actions bot locked and limited conversation to collaborators Mar 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Client This issue points to a problem in the data-plane of the library. Container Registry
Projects
None yet
Development

No branches or pull requests

4 participants