-
Notifications
You must be signed in to change notification settings - Fork 155
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
Add OCI registry collector #1279
base: main
Are you sure you want to change the base?
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
if err != nil { | ||
return fmt.Errorf("unable to retrieve artifacts from OCI collector: %w", err) | ||
} | ||
o.checkedDigest = ociCollector.checkedDigest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm the oci collector could skip all those that are duplicates. So no checks have to be done at the OCI registry collector.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few suggestions 👍 . Thanks
|
||
rcOpts := getRegClientOptions() | ||
rc := regclient.New(rcOpts...) | ||
defer rc.Close(ctx, r) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error returned from ref.New
is not checked before passing r to rc.Close
.
This could lead to a panic if ref.New returns an error.
if err != nil { | ||
return fmt.Errorf("failed to list repositories in registry %s: %w", o.registry, err) | ||
} | ||
if len(rl.Repositories) == 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rl.Repositories
is not checked for nil. This could cause a panic.
Suggestion: Add nil check on rl.Repositories.
|
||
rcOpts := getRegClientOptions() | ||
rc := regclient.New(rcOpts...) | ||
defer rc.Close(ctx, r) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Close can return an error. This would not be noticed if someone is trying to debug.
A recommendation would be to log this.
defer func(rc *regclient.RegClient, ctx context.Context, r ref.Ref) {
err := rc.Close(ctx, r)
if err != nil {
//log error
}
}(rc, ctx, r)
ddcd05f
to
4b6e5c8
Compare
This pull request has been automatically marked as stale because it has not had recent activity (60 days of inactivity). |
This pull request has been automatically closed because there has been no activity for 90 days. |
Re-opening this pull request as this is a feature that we want to add. FYI @ridhoq |
@ridhoq did you have any cycles to complete this PR? Would be a great feature to add in. |
Pinging this one so it doesn't close |
Signed-off-by: Ridwan Hoq <ridwanhoq@microsoft.com>
4b6e5c8
to
5a6ad76
Compare
Description of the PR
Support collecting all OCI artifacts in an OCI registry that has the
/v2/_catalog
endpoint enabled.TODO:
guacone
andguaccollect
?Fixes #298
PR Checklist
-s
flag togit commit
.make generate
has been runcollectsub
protobuf has been changed,make proto
has been run