Skip to content

oras repo ls to support sub namespaces #733

Closed

Description

@SteveLasker

What happened in your environment?

My registry contains multiple repos under nested namespaces

base-images/dotnet/core/sdk
base-images/node
hello-world
samples/helm/wordpress
samples/text
samples/thingthang
samples/txt

I'd like to find the repos under the samples/ namespace

calling oras repo ls demo42.azurecr.io gives an appropriate listing
However, calling oras repo ls demo42.azurecr.io/samples gives:
Error: invalid reference: invalid registry

What did you expect to happen?

list the repos under the /samples namespace. This would also be the case for something like docker that lists repos under an org namespace, although docker hub doesn't support the _catalog API :(

How can we reproduce it?

oras push $REGISTRY/samples/artifact:1.0 \
    --config /dev/null:readme/example\
    ./readme.md:application/markdown

oras repo ls $REGISTRY/samples

What is the version of your ORAS CLI?

0.16.0

What is your OS environment?

wsl2

Are you willing to submit PRs to fix it?

  • Yes, I am willing to fix it.

Activity

  1. added
    bug
    on Jan 4, 2023
  2. added this to the v1.0.0 milestone on Jan 4, 2023
  3. added
    enhancement
    ux
    and removed
    bug
    on Jan 4, 2023
  4. shizhMSFT commented on Jan 4, 2023

    @shizhMSFT
    Contributor

    Thank @SteveLasker for calling this out. It is a valid scenario to list repos in a sub namespace.

    @FeynmanZhou @yizha1 @qweeah This proposal may be conflict with #634. We need to pick either proposal to proceed.

  5. qweeah commented on Jan 4, 2023

    @qweeah
    Contributor

    This proposal may be conflict with #634.

    What if we don't provide this fuzzy listing in #634?
    Forget about it, user might still assume oras ls returns a repository list even when it returns a tag list

  6. qweeah commented on Jan 4, 2023

    @qweeah
    Contributor

    @SteveLasker Should this feature simply do a prefix matching or strictly follow <registry>/<namespace>/<sub-namespace>/<repo> matching? e.g. should sample-test/text be included or excluded in the output?

    oras repo ls $REGISTRY/samples
    samples/helm/wordpress
    samples/text
    samples/thingthang
    samples-test/text
    

    I am asking because I didn't find any existing OCI spec for namespace.

  7. shizhMSFT commented on Jan 4, 2023

    @shizhMSFT
    Contributor

    According to Repository namespaces, Repository, and user experience of other UNIX commands like ls, sample-test/text should be excluded in the output. That is, exact match should be performed.

  8. SteveLasker commented on Jan 5, 2023

    @SteveLasker
    ContributorAuthor

    Being able to list the repos is a key feature. The challenge is the _catalog API was removed from the spec, and left to as reserved for registries that did implement it.
    The challenge comes from different registered implementing multi-tenancy at different levels.
    ACR, ECR, and some others use a domain to isolate a registry: wabbitnetworks.azurecr.io vs. acmerockets.azurecr.io
    Other registered like Docker Hub and GitHub use root namespaces. docker.io/wabbitnetworks and docker.io/acmerockets
    ACME Rocket users don't have permissions to Wabbit Networks. And, we shouldn't assume everything is anonymous.
    See here for more details: Registry Names, Namespaces, Images, Artifacts & Tags

    While I'd like to see a replacement to the _catalog API as a standard across registries, we should at least support the registries that do support _catalog, but understand the namespace issues.
    This also aligns with the samples/ namespace issue here.

    As for the question on inclusion/exclusion in the output, I could see it being either way.
    What I'm not sure about is the pattern matching, vs. namespace mapping. Pattern matching may span multiple namespaces, where the user may not have permissions. In general, we've tried to avoid pattern matching, as it's a pandoras box that leads to REGEX matching as well.

  9. mathieu-benoit commented on Jan 19, 2023

    @mathieu-benoit

    Let me know if I need to file another issue, but I think my error is related to this one described here.

    I have a Google Artifact Registry repository ARTIFACT_REGISTRY_REPO_NAME in the region REGION and project PROJECT_ID. I'm able to push my OCI artifact in this registry, if I do:

    oras push \
        ${REGION}-docker.pkg.dev/${PROJECT_ID}/${ARTIFACT_REGISTRY_REPO_NAME}/my-artifact:1.0.0 \
        my-artifact.txt
    

    But if I do: oras repo ls ${REGION}-docker.pkg.dev/${PROJECT_ID}/${ARTIFACT_REGISTRY_REPO_NAME}, I will have this error:

    Error: invalid reference: invalid repository
    

    Same for oras repo ls ${REGION}-docker.pkg.dev/${PROJECT_ID}.

    But oras repo ls ${REGION}-docker.pkg.dev is working, but is too broad.

  10. wangxiaoxuan273 commented on Jan 20, 2023

    @wangxiaoxuan273
    Contributor

    I would like to work on this issue.

  11. FeynmanZhou commented on Jan 30, 2023

    @FeynmanZhou
    Member

    @mathieu-benoit Thanks for providing your use case with GAR for this scenario. I think it should be the same case with this issue. Could you help to confirm whether GAR supports _Catalog API for listing repositories? If YES, then it will be fixed within #768

  12. mathieu-benoit commented on Jan 30, 2023

    @mathieu-benoit

    Hi @FeynmanZhou, I got the confirmation that GAR supports the Catalog API. Once #768 is included in a release, I will test it then too. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancementux

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions