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

Set ConfigSource in bundleresolver #5684

Merged
merged 1 commit into from
Nov 10, 2022

Conversation

chuangw6
Copy link
Member

@chuangw6 chuangw6 commented Oct 25, 2022

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 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

Submitter Checklist

As the author of this PR, please check off the items in this checklist:

  • Has Docs included if any changes are user facing
  • Has Tests included if any functionality added or changed
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including
    functionality, content, code)
  • Has a kind label. You can add one by adding a comment on this PR that contains /kind <type>. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tep
  • Release notes block below has been updated with any user facing changes (API changes, bug fixes, changes requiring upgrade notices or deprecation warnings)
  • Release notes contains the string "action required" if the change requires additional action from users switching to the new release

Release Notes

ociresolver captures correct source information about where remote image came from.

@tekton-robot tekton-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. labels Oct 25, 2022
@tekton-robot tekton-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Oct 25, 2022
@chuangw6
Copy link
Member Author

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
/assign @jagathprakash

@tekton-robot
Copy link
Collaborator

@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.
For more information please see the contributor guide

In response to this:

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
/assign @jagathprakash

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) {
Copy link
Member

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?

Copy link
Member Author

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!

Copy link
Member

@wlynch wlynch left a 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
Copy link
Member

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

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good! Changed.

@chuangw6
Copy link
Member Author

chuangw6 commented Nov 1, 2022

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

Sure. That's indeed missed. I opened a new PR to add the test for easier review. PTAL #5704 @wlynch . Thank you!!

@chuangw6 chuangw6 changed the title Set ConfigSource in ociresolver Set ConfigSource in bundleresolver Nov 2, 2022
@abayer
Copy link
Contributor

abayer commented Nov 3, 2022

/approve

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 3, 2022
@chuangw6 chuangw6 requested review from wlynch and removed request for vdemeester and bobcatfish November 4, 2022 18:54
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/resolution/resolver/bundle/bundle.go 72.1% 72.2% 0.2

Copy link
Member

@wlynch wlynch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 10, 2022
@JeromeJu
Copy link
Member

/retest

@tekton-robot tekton-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 10, 2022
@chuangw6
Copy link
Member Author

chuangw6 commented Nov 10, 2022

Just updated the unit test a bit to compare the source field in resolutionrequest status. The reason is that we need to test the digest can be successfully resolved no matter the given bundle param has actual digest or a tag name. PTAL. Let me know if you have any feedback. Thanks @wlynch

@chuangw6 chuangw6 requested a review from wlynch November 10, 2022 14:40
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/resolution/resolver/bundle/bundle.go 72.1% 72.2% 0.2

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/resolution/resolver/bundle/bundle.go 72.1% 72.2% 0.2

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/resolution/resolver/bundle/bundle.go 72.1% 72.2% 0.2

@chuangw6 chuangw6 requested review from JeromeJu and wlynch and removed request for wlynch and JeromeJu November 10, 2022 17:25
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>
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/resolution/resolver/bundle/bundle.go 72.1% 72.2% 0.2

Copy link
Member

@wlynch wlynch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 10, 2022
@tekton-robot
Copy link
Collaborator

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants