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

Registry collector to expand OCI collector #298

Open
pxp928 opened this issue Jan 5, 2023 · 0 comments · May be fixed by #1279
Open

Registry collector to expand OCI collector #298

pxp928 opened this issue Jan 5, 2023 · 0 comments · May be fixed by #1279
Labels
enhancement New feature or request long-term Things for the future

Comments

@pxp928
Copy link
Collaborator

pxp928 commented Jan 5, 2023

Implementation of a registry collector, where the collector would query for all repositories and pull all metadata stored for each, was put on hold as _catalog API is not implemented the same across all registries. This would result in fixes and bugs depending on which registry (cloud or private) the user utilized. Each cloud-hosted registry adds its own custom API for listing things within a single org. We can revisit this later if needed but oci collector is currently setup such that it can be called by an upstream "registry collector" to collect from all repos in a registry in the future if needed. This can be done by the following using regclient API:

   repoTags := map[string][]string{}
   r, err := ref.New(o.registry)
   if err != nil {
     return fmt.Errorf("failed to parse ref %s: %v", r, err)
   }
   defer rc.Close(ctx, r)

   rl, err := rc.RepoList(ctx, o.registry)
   if err != nil && errors.Is(err, types.ErrNotImplemented) {
     return fmt.Errorf("registry %s does not support underlying _catalog API: %w", o.registry, err)
   }

   for _, repo := range rl.Repositories {
     r, err := ref.New(repo)
     if err != nil {
       return err
     }
     collectedTags, err := rc.TagList(ctx, r)
     if err != nil {
       return err
     }
     repoTags[repo] = collectedTags
   }

   ociRepoCollector := NewOCIRepoCollector(ctx, repoTags, false, time.Second)
   ociRepoCollector.RetrieveArtifacts(ctx, docChannel)
   o.checkedDigest[repo] = ociRepoCollector.checkedDigest
   return nil
@pxp928 pxp928 added enhancement New feature or request long-term Things for the future labels Jan 5, 2023
@ridhoq ridhoq linked a pull request Sep 15, 2023 that will close this issue
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request long-term Things for the future
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant