acr icon indicating copy to clipboard operation
acr copied to clipboard

Multiple tags for acr import

Open phatcher opened this issue 5 years ago • 12 comments

What is the problem you're trying to solve I migrate my images from a devtest to production container registry when they pass a certain stage in the CI/CD pipeline using acr import, however, this only associates the build id with the target image.

Describe the solution you'd like A version of acr import that takes all associated tags of the source image, so as well as the DevOps buildId, I would get my semver tags

phatcher avatar Dec 15 '20 17:12 phatcher

Hi @phatcher, thanks for the feature request! In this scenario, would it help if you first az acr repository show-tags -n myregistry --repository myrepo to query tags of the source image, and then import them to the target?

Wwwsylvia avatar Dec 17 '20 08:12 Wwwsylvia

@Wwwsylvia That retrieves all tags for that repo, what I'm interested in are the tags associated with a particular other tag i.e. the build id, sorry if I wasn't clear before.

The DevOps task looks something like this...

az acr import --name myprodacr --source mydevacr/myapi:$(Release.Artifacts._Api.BuildId) -u $(registryUserName) -p $(registryPassword) --force

I can't carry over the other associated tags as part of the release info due to a DevOps limitation, but they are in the container registry.

Each build has five tags...

  1. The build id - unique build number from DevOps
  2. The Sha-1 hash code
  3. The SemVer tags e.g. 1, 1.2, 1.2.5

At the moment the only way of referring to the image is via the build id or the hash, and what I'd like to be able to do is to be able to tell the AppService to pull myapi:1.2 - allows for more testing scenarios etc.

phatcher avatar Dec 17 '20 11:12 phatcher

@phatcher Do you mean something like below?

Suppose you have some tags pointing to the same image in registry mydevacr mydevacr.azurecr.io/myapi@sha256:123 tagged by myapi:${buildId}, myapi:${hashcode}, myapi:1.0

And you run a single az acr import command, then the image will be imported and automatically tagged myprodacr.azurecr.io/myapi@sha256:123 tagged by myapi:${buildId}, myapi:${hashcode}, myapi:1.0

Wwwsylvia avatar Dec 18 '20 09:12 Wwwsylvia

Exactly, with the option of to override tags on other images, e.g. we are importing myapi:1.2.1 which will also have a myapi:1.2 and myapi:1 tag, as there will likely be an existing 1.2 tag from the 1.2.0 build

phatcher avatar Dec 18 '20 10:12 phatcher

@yugangw-msft Please see my last reply. Do we have plan to support that?

Wwwsylvia avatar Dec 21 '20 02:12 Wwwsylvia

We have a work item with similar ask: https://github.com/Azure/acr/issues/48. @phatcher, please let me know if the work is not sufficient.

yugangw-msft avatar Dec 22 '20 00:12 yugangw-msft

@yugangw-msft Did you really mean #48 - that's about 3 years old and just is docs regarding CircleCI?

phatcher avatar Dec 22 '20 10:12 phatcher

Sorry for the typo @phatcher , I meant the #481

yugangw-msft avatar Dec 22 '20 17:12 yugangw-msft

@yugangw-msft I think it's part of it, what I don't see from that is how I would determine what tags are associated with a particular manifest.

The general point is that I want to use this as part of a CI/CD pipeline and I don't know a priori what tags will exist on a specific image.

phatcher avatar Dec 22 '20 18:12 phatcher

So there are potentially 2 asks here.

  1. Enable an API that retrieves all tags for an image. Today you can only query the first 10 tags of an image
az acr repository show -t 100tags@sha256:90659bf80b44ce6be8234e6ff90a1ac34acbeb826903b02cfa0da11c82cbc042
{
  "os": "linux",
  "tags": [
    "1",
    "10",
    "100",
    "101",
    "102",
    "103",
    "104",
    "105",
    "106",
    "107"
  ]
}
  1. Request import to pull in all the tags..

sajayantony avatar Jan 29 '21 02:01 sajayantony

@toddysm - Given that we haven't been able to get to this issue, should we close this as something we don't think that will be addressed.

sajayantony avatar Sep 02 '21 23:09 sajayantony

@sajayantony Not to be funny but what else are you working on - if you don't want to do it, give me a way that I can contribute a fix!

This sort of stuff is basic for an enterprise grade system.

phatcher avatar Sep 10 '21 11:09 phatcher