azure-cli icon indicating copy to clipboard operation
azure-cli copied to clipboard

Wildcards in repository names

Open mkstephenson opened this issue 7 years ago • 63 comments

When defining the repositories in the scope-map, can you use wildcards? So if you have a convention that each repository is named <team_name>/<project_name>, you could use <team_name>/* to provide a team with access to all of their repositories without listing each one individually and also automatically provide access to any future repositories created by this team?


Dokumentdetails

⚠ Bearbeiten Sie diesen Abschnitt nicht. Er ist für die Verknüpfung von docs.microsoft.com zum GitHub-Artikel erforderlich.

mkstephenson avatar Nov 19 '19 15:11 mkstephenson

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @stevelasker, @sajayanthony

ghost avatar Nov 20 '19 02:11 ghost

Thanks for the suggestions. Repository based permission control is still under preview, and we will take this feedback into consideration and update here when we roll out any improvements.

yugangw-msft avatar Nov 21 '19 23:11 yugangw-msft

I am also looking for a help on "Wildcards in repository names ", any update on this?

shwetazambre avatar Apr 21 '20 08:04 shwetazambre

Hi folks. We’re looking into various options. Can you provide more details on what the result is you’re looking to accomplish?

SteveLasker avatar Apr 21 '20 14:04 SteveLasker

I created a scope map with a wildcard so that many repositories can make use of it. And with this scope map generated a token and logged in to the registry. But I couldn't perform any operation like a pull or push.

e.g repositories:

test/myrepo test/myrepo1 test/myrepo2 test/myrepo3

Scope-map I have created:

az acr scope-map create --name MyScopeMap --registry MyRegistry --repository test/* content/read content/write --description "test scope map"

Result: { "actions": [ "repositories/test/*/content/read", "repositories/test/*/content/write" ], "creationDate": "2020-04-20T11:27:49.643716+00:00", "description": "test scope map", "id": "/subscriptions/----/resourceGroups/mytest-rg/providers/Microsoft.C ontainerRegistry/registries/MyRegistry/scopeMaps/MyScopeMap", "name": "MyScopeMap", "provisioningState": "Succeeded", "resourceGroup": "mytest-rg", "scopeMapType": "UserDefined", "type": "Microsoft.ContainerRegistry/registries/MyScopeMap" }

Scope map has created successfully and even token too. But when I logged in with that token and try to pull/push I ended up with below message:

pull - docker pull myregistry.azurecr.io/test/myrepo:v1

message:

"Error response from daemon: repository myregistry.azurecr.io/test/myrepo not found: does not exist or no pull access"

push - docker push myregistry.azurecr.io/test/myrepo:v2

message:

The push refers to a repository [myregistry.azurecr.io/test/myrepo] a65c16532822: Preparing 75b1b9938a41: Preparing 94a7e5001357: Preparing fea4f503ccf8: Preparing 3172a1c8308a: Preparing 264a7fdea008: Waiting 3b10514a95be: Waiting denied: requested access to the resource is denied

shwetazambre avatar Apr 22 '20 06:04 shwetazambre

@shwetazambre, thanks for the details. We don’t support wildcards like this. Based on feedback like this, we’re re-evaluating the approach and are seeking feedback. Can you explain what you’re trying to accomplish? Are you looking to have management delegation to team leads for a set of repos? Or, can a single set of people manage permissions for all teams? In other words, do you need permissions isolation between teams? TeamA can manage their set of repos, while teamB manages their repositories? The owners of TeamA can’t manage TeamBs repos

SteveLasker avatar Apr 22 '20 14:04 SteveLasker

@shwetazambre, thanks for the details. We don’t support wildcards like this. Based on feedback like this, we’re re-evaluating the approach and are seeking feedback. Can you explain what you’re trying to accomplish? Are you looking to have management delegation to team leads for a set of repos? Or, can a single set of people manage permissions for all teams? In other words, do you need permissions isolation between teams? TeamA can manage their set of repos, while teamB manages their repositories? The owners of TeamA can’t manage TeamBs repos

That is the approach we were looking for as well. We need to be able to assign repo based permissions and would prefer not to have to define it for every single repo since we work with prefixes for teams.

mkstephenson avatar Apr 22 '20 15:04 mkstephenson

We’re considering two approaches. The wildcard approach, which could give different groups different access. The second approach is about delegating management to teams. Imagine an Org like management approach similar to github or docker hub. The later is a lot more complicated to split permissions and logs. But, we’d rather understand that now, before we implement wildcards that won’t scale. Which approach do you need?

SteveLasker avatar Apr 22 '20 15:04 SteveLasker

As far as I know, we are looking for an approach similar to the first one. Here I consider the group as a project/team. If we assign read-only permission for project1/team1 then all repositories under that project/team will have the same permission. Different projects will have different permissions and all repositories, sub-repositories will work according to that permissions.

shwetazambre avatar May 05 '20 07:05 shwetazambre

We like the concept of namespaces, as that is described in a section in the "best practices". I'd like to enable teams full access to one or several "namespaces". I guess that could work with tokens & wildcard scope maps, but I can imagine this not scaling well. So we'd prefer a "full fledged" solution to be able to control access to namespaces for groups - ideally without tokens - distributing these will definitely not scale.

BenjaminHerbert avatar May 06 '20 05:05 BenjaminHerbert

We're looking for this feature too and would upgrade to the Premium SKU if it was available. Our needs are fairly simple right now, so the first approach would be sufficient for us, but I could see some benefit to the second approach as well.

ajhall avatar May 28 '20 16:05 ajhall

+1 on this request. Given that a docker push can dynamically create new repositories, creating a read or write token that has access to company/* would be super helpful.

I should add that the only reason I need to define custom scope-maps is because the built in scope maps don't include metadata read/write. That is:

  • _repositories_push doesn't include metadata/read or metadata/write
  • _repositories_pull doesn't include metadata/read

Which breaks docker buildx as used in Docker's official docker/build-push-action@v2 github action.

It would also seem there are a few more votes for this at https://feedback.azure.com/forums/903958-azure-container-registry/suggestions/40878493-give-the-repositories-pull-repositories-push-m

shaunco avatar Sep 19 '20 22:09 shaunco

+1 on this request. Not being able to use wildcards or use directories to scope permissions makes this nigh unusable.

soring-isb avatar Nov 10 '20 13:11 soring-isb

+1

AntonioNaranjo1 avatar Mar 15 '21 09:03 AntonioNaranjo1

+1 something like reponame/* or "shortcut" reponame/

steffen201706 avatar May 07 '21 11:05 steffen201706

+1 This would be very useful when planning deployment scenarios where product names are namespaces and access needs to given in multiple setups.

galigula2 avatar May 31 '21 08:05 galigula2

@SteveLasker any further news in this area? I want everyone in my company share a single ACR, but only allow individual teams push permissions to their own "namespace".

companyacr.azurecr.io/customerteam/* companyacr.azurecr.io/productteam/*

illrill avatar May 31 '21 16:05 illrill

This is the plan, to align AAD objects, Tokens and namespace hierarchy of access. We have been discussing the root namespace for a team can have slashes to account for these types of paths

companyacr.azurecr.io/baseartifacts/ companyacr.azurecr.io/org1/teama/ companyacr.azurecr.io/org2/teama/ companyacr.azurecr.io/prod/ companyacr.azurecr.io/archive

It won’t actually be star wildcards, rather repo path based.

Will that work? @mangalorereshmi for details.

SteveLasker avatar May 31 '21 16:05 SteveLasker

@SteveLasker not sure what you mean by "teams" in this context? We have multiple teams working with group of products (sometimes same people work also on different products) so our scheme would be

companyacr.azurecr.io/product-a/service-a companyacr.azurecr.io/product-a/service-b companyacr.azurecr.io/product-b/service-c companyacr.azurecr.io/product-b/service-d

We'd like to create push Scope maps to match e.g. companyacr.azurecr.io/product-a/* to be able to push to all repositories under a single product and pull Scope maps with read access to product-a/* and product-b/* so we can combine containers from multiple products.

Not sure how this team model would work in this case?

Perhaps the * wildcard could work in tandem with the team feature? We're basically just looking to avoid typing and managing all of the repositories manually.

galigula2 avatar May 31 '21 16:05 galigula2

@galigula2, Reshmi is off this week, so let me try and explain a bit.

Reshmi has designed a repo-group option, which is essentially a github or docker hub org. The big difference is we can provide /'s within the org name, or the repo name so you get more flexibility.

Using your example above, you could create companyacr.azurecr.io/product-a/ and all repos below it would be managed by the admin of product-a.

What this can also look like is:

  • companyacr.azurecr.io/baseartifacts/ - is the root of this "repo-group" Below, you may have several repos, with additional nesting to give groups (teams) a hierarchy to work with:
    • companyacr.azurecr.io/baseartifacts/publicimages/node - notice the node image is in the root of publicimages
    • companyacr.azurecr.io/baseartifacts/publicimages/dotnet/sdk - in the donnet case, there are several images within dotnet, so you can use additional /'s in the name
    • companyacr.azurecr.io/baseartifacts/publicimages/dotnet/runtime
    • companyacr.azurecr.io/baseartifacts/publicimages/dotnet/aspnet
    • companyacr.azurecr.io/baseartifacts/publicimages/java/sdk
    • companyacr.azurecr.io/baseartifacts/publicimages/java/runtime

The root of the repo-group may also have /'s in the names, so you can structure your repo-groups alongside your company lines.

  • companyacr.azurecr.io/org1/team-a/ - team-a within org 1 has it's own admin to assign permissions to identities
    • companyacr.azurecr.io/org1/team-a/service-a
    • companyacr.azurecr.io/org1/team-a/service-b
    • companyacr.azurecr.io/org1/team-a/service-c
    • companyacr.azurecr.io/org1/team-a/build-components/thing1
    • companyacr.azurecr.io/org1/team-a/build-components/thing2 Team-b is in another org of the company, so you can group teams while still having the appearance of hierarchy
  • companyacr.azurecr.io/org2/team-b/
    • companyacr.azurecr.io/org2/team-b/service-f
    • companyacr.azurecr.io/org2/team-b/service-g Maybe another root repo, where you keep all production deployments, and no developers have access. An operational person assigns permissions for service identities to pull repos from below this location:
  • companyacr.azurecr.io/prod/ -
    • companyacr.azurecr.io/prod/service-a
    • companyacr.azurecr.io/prod/service-b
    • companyacr.azurecr.io/prod/service-c And another root repo managed by a team that accounts for all archived content
  • companyacr.azurecr.io/archive
    • companyacr.azurecr.io/archive/service-a
    • companyacr.azurecr.io/archive/service-b
    • companyacr.azurecr.io/archive/service-c

SteveLasker avatar Jun 01 '21 22:06 SteveLasker