-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Set ConfigSource in bundleresolver #5684
Conversation
a2c7b52
to
d47c22d
Compare
Hey @jagathprakash @wlynch, Please take a look at this PR when you have a minute. This PR aims to set a correct source value for the OCI bundle image. Thank you!! /assign @wlynch |
@chuangw6: GitHub didn't allow me to assign the following users: jagathprakash. Note that only tektoncd members, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
}, nil | ||
} | ||
} | ||
return nil, fmt.Errorf("could not find object in image with kind: %s and name: %s", opts.Kind, opts.EntryName) | ||
} | ||
|
||
// retrieveImage will fetch the image's contents and manifest. | ||
func retrieveImage(ctx context.Context, keychain authn.Keychain, ref string) (v1.Image, error) { | ||
func retrieveImage(ctx context.Context, keychain authn.Keychain, ref string) (string, v1.Image, error) { |
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.
Thanks Chuang!
Can we also update the comment above for the return values?
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.
Good catch! Thanks @JeromeJu . Updated!
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.
Looks good! Can we add tests?
See https://github.com/tektoncd/pipeline/blob/76e40b5a7b11262bfaa96ae31f28db2009002115/test/remote_test.go for an example of how to setup a local test registry
img, err := retrieveImage(ctx, keychain, opts.Bundle) | ||
uri, img, err := retrieveImage(ctx, keychain, opts.Bundle) | ||
if err != nil { | ||
return nil, err |
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.
These errors may be a bit difficult to know where they come from on their own - you may want to wrap them with a fmt.Errorf
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.
Sounds good! Changed.
d47c22d
to
66ef330
Compare
Sure. That's indeed missed. I opened a new PR to add the test for easier review. PTAL #5704 @wlynch . Thank you!! |
66ef330
to
53a1058
Compare
/approve |
53a1058
to
2e63aaf
Compare
The following is the coverage report on the affected files.
|
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.
/lgtm
/retest |
2e63aaf
to
4a1f6cd
Compare
Just updated the unit test a bit to compare the |
The following is the coverage report on the affected files.
|
4a1f6cd
to
9bc5f7f
Compare
The following is the coverage report on the affected files.
|
9bc5f7f
to
bec38a2
Compare
The following is the coverage report on the affected files.
|
Prior, a field named Source was introduced to `ResolutionRequest` status to record the source where the remote resource came from. And the individual resolvers need to implement the Source function to set the correct source value. But the method in ociresolver returns a nil value. Now, we return correct source value with the 3 subfields: url, digest and entrypoint - `uri`: The image repository URI - `digest`: The map of the algorithm portion -> the hex encoded portion of the image digest. - `entrypoint`: The resource name in the OCI bundle image. Signed-off-by: Chuang Wang <chuangw@google.com>
bec38a2
to
44ca742
Compare
The following is the coverage report on the affected files.
|
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.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: abayer, wlynch The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Changes
/kind feature
Related to #5522
Prior, a field named Source was introduced to
ResolutionRequest
status to record the source where the remote resource came from. And the individual resolvers need to implement the Source function to set the correct source value. But the method in ociresolver returns a nil value.Now, we return correct source value with the 3 subfields: url, digest and entrypoint
url
: The image repository URIdigest
: The map of the algorithm portion -> the hex encoded portion of the image digest.entrypoint
: The resource name in the OCI bundle image.Signed-off-by: Chuang Wang chuangw@google.com
Submitter Checklist
As the author of this PR, please check off the items in this checklist:
functionality, content, code)
/kind <type>
. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tepRelease Notes