Skip to content

[FEATURE REQ] ContainerRepository.GetAllTagProperties is missing #49183

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

Open
brianwp3000 opened this issue Apr 1, 2025 · 8 comments
Open

[FEATURE REQ] ContainerRepository.GetAllTagProperties is missing #49183

brianwp3000 opened this issue Apr 1, 2025 · 8 comments
Labels
Client This issue points to a problem in the data-plane of the library. Container Registry customer-reported Issues that are reported by GitHub users external to the Azure organization. feature-request This issue requires a new behavior in the product in order be resolved. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team
Milestone

Comments

@brianwp3000
Copy link

brianwp3000 commented Apr 1, 2025

Library name

Azure.Containers.ContainerRegistry

Please describe the feature.

RegistryArtifact.GetAllTagProperties already allows users to list all the tags for a given registry artifact, but that is not the same as listing all the tags for a given repository.

Listing the tags for a repository is possible with the REST api (see https://learn.microsoft.com/en-us/rest/api/containerregistry/tag/get-list) and is already present in the internal sdk (see ContainerRegistryRestClient.GetTags), but there is no way to do this using the public sdk. A GetAllTagProperties method on the ContainerRepository class would make sense to fix this.

I was in the process of replacing our project's handwritten wrapper over the ACR REST api with the Azure.Container.ContainerRegistry package when I found this disparity, and it's currently a hard blocker on that work.

@github-actions github-actions bot added Client This issue points to a problem in the data-plane of the library. Container Registry customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Apr 1, 2025
Copy link

github-actions bot commented Apr 1, 2025

Hello @brianwp3000. I'm an AI assistant for the azure-sdk-for-net repository. I have some suggestions that you can try out while the team gets back to you.

  • The current public method, RegistryArtifact.GetAllTagProperties, only provides tag listing for a single artifact rather than for an entire repository.

  • The REST API does offer repository-level tag listing (Get Tag List), and our internal SDK (via ContainerRegistryRestClient.GetTags) already supports this scenario.

  • We understand that this feature gap is a blocker for replacing custom wrappers and agree that exposing repository-wide tag retrieval via a public API would be valuable.

  • As a temporary workaround, consider invoking the REST API directly or wrapping the internal API (with caution since internal methods may change) until a public solution is available.

  • Your feedback is appreciated and will help drive the feature prioritization in our future releases.

The team will get back to you shortly, hopefully this helps in the meantime.

@jsquire jsquire assigned jsquire and unassigned annelo-msft Apr 2, 2025
@jsquire
Copy link
Member

jsquire commented Apr 2, 2025

Hi @brianwp3000. Thanks for reaching out and we regret that you're experiencing difficulties. You'll want to use RegistryArtifact.GetAllTagProperties. That method calls ContainerRegistryRestClient.GetTags, which invokes the ContainerRegistry_GetTags, which is the REST API that you've linked.

@jsquire jsquire added the issue-addressed Workflow: The Azure SDK team believes it to be addressed and ready to close. label Apr 2, 2025
@github-actions github-actions bot removed the needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team label Apr 2, 2025
Copy link

github-actions bot commented Apr 2, 2025

Hi @brianwp3000. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text "/unresolve" to remove the "issue-addressed" label and continue the conversation.

@brianwp3000
Copy link
Author

/unresolve

Sorry if i wasn't clear--the RegistryArtifact.GetAllTagProperties method is not the same as getting all the tags for a repository. If you look at the example in the docs, you can see that RegistryArtifact.GetAllTagProperties only lists the tags that point to a specific artifact within a repository--it does not list all the tags in the repository.
In other words: RegistryArtifact.GetAllTagProperties can return all the tags that point to "library/hello-world:latest", but it can't return all the tags that point to "library/hello-world".

@github-actions github-actions bot added needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team and removed issue-addressed Workflow: The Azure SDK team believes it to be addressed and ready to close. labels Apr 2, 2025
@jsquire
Copy link
Member

jsquire commented Apr 3, 2025

Hi @brianwp3000. Thank you for the additional context. Forgive me if I'm missing a nuance, but looking at the implementation, I do not think that the tagOrDigest passed when getting an artifact is used in the tags request. Only the repository name is included as part of the REST call, which I believe matches what you're describing.

Starting with the example:

// Get the service endpoint from the environment
Uri endpoint = new Uri(Environment.GetEnvironmentVariable("REGISTRY_ENDPOINT"));

// Create a new ContainerRegistryClient for anonymous access
ContainerRegistryClient client = new ContainerRegistryClient(endpoint);

// Obtain a RegistryArtifact object to get access to image operations
RegistryArtifact image = client.GetArtifact("library/hello-world", "latest");

// List the set of tags on the hello_world image tagged as "latest"
Pageable<ArtifactTagProperties> tags = image.GetAllTagProperties();

Tracing the code, what I'm seeing is:

  • The client creates a RegistryArtifact passing repositoryName and tagOrDigest as individual parameters to the constructor. (src)

  • RegistryArtifact stores repositoryName and tagOrDigest individually. (src)

  • RegistryArtifact.GetAllTagPropertiesAsync calls into the REST client's GetTagsAsync, passing only the repository name. The tagOrDigest data doesn't flow to the REST level. In other words, the REST client does not know about "latest" from the example or have access to it. (src)

  • In CreateGetTagsRequest, the REST client forms the request using the path {base_url}/acr/v1/repository_name/_tags and then appends parameters to the query string for paging, ordering, etc. The tagOrDigest isn't in scope and is not used to constrain the request. From the example, the request would go to $"{endpoint}/acr/v1/library/hello-world/_tags" - which I believe is what you'd like. (src)

  • This matches up with the pattern in the REST API spec, which also does not have any reference to the concept of tagOrDigest - just the repository name. Though it is an older version of the REST API, it matches exactly the endpoint that you've linked. (src)

If there's a nuance or detail that I'm overlooking, I'd appreciate your insight.

@jsquire jsquire added needs-author-feedback Workflow: More information is needed from author to address the issue. and removed needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team labels Apr 3, 2025
Copy link

github-actions bot commented Apr 3, 2025

Hi @brianwp3000. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue.

@brianwp3000
Copy link
Author

brianwp3000 commented Apr 3, 2025

In the source code for RegistryArtifact.GetAllTagProperties it calls GetDigest (src) and passes that into the REST client's GetTagsAsync (src). Then, in CreateTagsRequest it appends that digest to the url so the request goes to $"{endpoint}/acr/v1/library/hello-world/_tags?digest={digest}" (src). Which makes the request return all the tags that point to the artifact with that digest (i.e. all the tags that point to "library/hello-world:latest"), not all the tags for the entire repository.

So you're right that calling GetTagsAsync with a null digest will perform the request that I want, but there's no way for me to do it with the current SDK.

@github-actions github-actions bot added needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team and removed needs-author-feedback Workflow: More information is needed from author to address the issue. labels Apr 3, 2025
@jsquire
Copy link
Member

jsquire commented Apr 3, 2025

@brianwp3000: Thanks, that was my disconnect. I did indeed overlook it being passed via query parameter, as I was too focused on the URL being formed. Thanks for your patience breaking that down. We're now in agreement that what you're looking for isn't accessible.

I'll mark this as a feature request and move to the backlog for future consideration. ACR has not been a very active library, so I'm not confident that you'll see this added in the short term. In the meantime, to get you unblocked, creating a custom policy would give you access to the raw request URL before it is sent and allow you to strip out the unwanted query string parameter.

One implementation would look something like:

Policy

public class GetRidOfDigestRequestPolicy: HttpPipelineSynchronousPolicy
{
    public override void OnSendingRequest(HttpMessage message)
    {
        if (message.Request.Uri.Path.EndsWith("_tags"))
        {
            var query = HttpUtility.ParseQueryString(message.Request.Uri.Query);
            query.Remove("digest");
        
            message.Request.Uri.Query = query.ToString();
        }
    }
}

Setting the policy for the client

var options = new ContainerRegistryClientOptions();
options.AddPolicy(new CustomRequestPolicy(), HttpPipelinePosition.PerCall);

var client = new ContainerRegistryClient(endpoint, options);

@jsquire jsquire removed their assignment Apr 3, 2025
@jsquire jsquire added feature-request This issue requires a new behavior in the product in order be resolved. and removed question The issue doesn't require a change to the product in order to be resolved. Most issues start as that needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team labels Apr 3, 2025
@jsquire jsquire added this to the Backlog milestone Apr 3, 2025
@github-actions github-actions bot added the needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team label Apr 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client This issue points to a problem in the data-plane of the library. Container Registry customer-reported Issues that are reported by GitHub users external to the Azure organization. feature-request This issue requires a new behavior in the product in order be resolved. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team
Projects
None yet
Development

No branches or pull requests

3 participants