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

Grafeas storage for PipelineRun-level provenance #590

Merged

Conversation

chuangw6
Copy link
Member

@chuangw6 chuangw6 commented Oct 5, 2022

Changes

Support storing pipelinerun level provenance in grafeas
backend.

There are 3 main aspects of the PR:

  • created different BUILD Notes for storing both taskrun and pipelinerun
    level provenance/occurrence in grafeas that attest the same artifact.
  • extracted artifact identifiers from intoto subjects instead of calling
    individual helpers to extract from results.
  • changed TektonObject "GetKind" method to "GetGVK" to get the whole
    GroupVersionKind information.

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

Support Grafeas storage for PipelineRun level provenance

Comment on lines 70 to 92
// Get the TaskRun kind
func (tro *TaskRunObject) GetKind() string {
return tro.GetObjectKind().GroupVersionKind().Kind
// Get the TaskRun GroupVersionKind
func (tro *TaskRunObject) GetGVK() string {
return fmt.Sprintf("%s/%s", tro.GetGroupVersionKind().GroupVersion().String(), tro.GetGroupVersionKind().Kind)
Copy link
Member Author

Choose a reason for hiding this comment

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

Hey @bcaton85 @lcarva
I am trying to change GetKind to GetGVK for two reasons 1/ previous tro.GetObjectKind().GroupVersionKind().Kind seems to return empty string in logs, 2/ get the full GVK so that we can reuse it at a lot of places i.e. intoto BuildType and grafeas side.
Please comment if you have any concerns/questions. Thanks!

Copy link
Contributor

@bcaton85 bcaton85 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, added minor comments. Glad this got worked on. Given i haven't ran this since I don't have a Grafeas backend to test with.

EDIT: Overlooked that this is still in draft, please ignore these comments...

pkg/chains/storage/grafeas/grafeas_test.go Outdated Show resolved Hide resolved
pkg/chains/storage/grafeas/grafeas.go Outdated Show resolved Hide resolved
pkg/chains/storage/grafeas/grafeas.go Show resolved Hide resolved
@tekton-robot
Copy link

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@tekton-robot tekton-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 5, 2022
@tekton-robot tekton-robot requested review from lcarva and wlynch October 5, 2022 14:16
@tekton-robot tekton-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Oct 5, 2022
@chuangw6 chuangw6 force-pushed the pipeline-provenance-grafeas-storage branch 3 times, most recently from 8923651 to 9358ae5 Compare October 7, 2022 21:12
@tekton-robot tekton-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Oct 7, 2022
@chuangw6 chuangw6 marked this pull request as ready for review October 7, 2022 21:15
@tekton-robot tekton-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 7, 2022
@tekton-robot tekton-robot requested a review from lcarva October 7, 2022 21:15
@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/chains/formats/intotoite6/taskrun/taskrun.go 74.6% 75.8% 1.1
pkg/chains/storage/grafeas/grafeas.go 79.3% 78.4% -0.9

@chuangw6 chuangw6 force-pushed the pipeline-provenance-grafeas-storage branch 2 times, most recently from 3ba795c to 34ea01c Compare October 7, 2022 22:20
@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/chains/formats/intotoite6/taskrun/taskrun.go 74.6% 75.8% 1.1
pkg/chains/storage/grafeas/grafeas.go 79.3% 78.4% -0.9

@chuangw6
Copy link
Member Author

This PR is ready for review. Please take a look @wlynch, @jagathprakash, @lcarva when you get a chance. Thank you very much for your time and feedback in advance!

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.

Mostly LGTM!

Just some small tweaks.

pkg/config/config.go Outdated Show resolved Hide resolved
pkg/chains/storage/grafeas/grafeas_test.go Outdated Show resolved Hide resolved
pkg/chains/storage/grafeas/grafeas_test.go Outdated Show resolved Hide resolved
pkg/chains/storage/grafeas/grafeas_test.go Outdated Show resolved Hide resolved
pkg/chains/storage/grafeas/grafeas_test.go Show resolved Hide resolved
pkg/chains/storage/grafeas/grafeas_test.go Outdated Show resolved Hide resolved
pkg/chains/storage/grafeas/grafeas_test.go Outdated Show resolved Hide resolved
pkg/chains/storage/grafeas/grafeas_test.go Outdated Show resolved Hide resolved
pkg/chains/storage/grafeas/grafeas_test.go Outdated Show resolved Hide resolved
@chuangw6 chuangw6 force-pushed the pipeline-provenance-grafeas-storage branch from 34ea01c to 4e6bc2a Compare October 17, 2022 14:46
@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/chains/formats/intotoite6/taskrun/taskrun.go 74.6% 75.8% 1.1
pkg/chains/storage/grafeas/grafeas.go 79.3% 78.4% -0.9

@chuangw6
Copy link
Member Author

chuangw6 commented Oct 17, 2022

Mostly LGTM!

Just some small tweaks.

Hey @wlynch,
Thank you so much for reviewing the PR. I've incorporated all the comments in the recent change except the unresolved one. Please take a look and let me know what you think. Happy to change accordingly. Also for other resolved comments, feel free to reopen if you have more comments. Thank you very much!

@chuangw6 chuangw6 requested review from wlynch and removed request for lcarva and wlynch October 17, 2022 14:58
@chuangw6 chuangw6 force-pushed the pipeline-provenance-grafeas-storage branch from 4e6bc2a to 855d2ca Compare October 17, 2022 17:20
@chuangw6 chuangw6 force-pushed the pipeline-provenance-grafeas-storage branch from c71e429 to 813639e Compare October 18, 2022 19:54
@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/chains/formats/intotoite6/extract/extract.go Do not exist 51.4%
pkg/chains/formats/intotoite6/taskrun/taskrun.go 74.6% 75.8% 1.1
pkg/chains/storage/grafeas/grafeas.go 78.8% 77.4% -1.4

@chuangw6 chuangw6 requested a review from wlynch October 18, 2022 20:21
@chuangw6
Copy link
Member Author

/assign @wlynch

added you as assignee. Thank you for the thorough review!!

@tekton-robot tekton-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 20, 2022
@chuangw6 chuangw6 force-pushed the pipeline-provenance-grafeas-storage branch from 813639e to c38ac52 Compare October 20, 2022 14:10
@tekton-robot tekton-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 20, 2022
@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/chains/formats/intotoite6/extract/extract.go Do not exist 48.8%
pkg/chains/formats/intotoite6/taskrun/taskrun.go 75.4% 76.5% 1.1
pkg/chains/storage/grafeas/grafeas.go 78.8% 77.4% -1.4

@chuangw6 chuangw6 force-pushed the pipeline-provenance-grafeas-storage branch from c38ac52 to da304fa Compare October 20, 2022 19:38
@tekton-robot tekton-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 20, 2022
@chuangw6 chuangw6 force-pushed the pipeline-provenance-grafeas-storage branch from da304fa to d1975b2 Compare October 20, 2022 19:50
@tekton-robot tekton-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 20, 2022
@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/chains/formats/intotoite6/extract/extract.go Do not exist 41.9%
pkg/chains/formats/intotoite6/taskrun/taskrun.go 75.4% 76.5% 1.1
pkg/chains/storage/grafeas/grafeas.go 78.8% 77.4% -1.4

@chuangw6 chuangw6 force-pushed the pipeline-provenance-grafeas-storage branch 2 times, most recently from 0bf0171 to b28271f Compare October 20, 2022 20:10
@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/chains/formats/intotoite6/extract/extract.go Do not exist 41.9%
pkg/chains/formats/intotoite6/taskrun/taskrun.go 75.4% 76.5% 1.1
pkg/chains/storage/grafeas/grafeas.go 78.8% 77.4% -1.4

tekton-provenance storage option is not supported anymore.

Signed-off-by: Chuang Wang <chuangw@google.com>

Signed-off-by: Chuang Wang <chuangw@google.com>
@chuangw6 chuangw6 force-pushed the pipeline-provenance-grafeas-storage branch from b28271f to 1695aed Compare October 20, 2022 20:28
@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/chains/formats/intotoite6/extract/extract.go Do not exist 41.9%
pkg/chains/formats/intotoite6/taskrun/taskrun.go 75.4% 76.5% 1.1
pkg/chains/storage/grafeas/grafeas.go 78.8% 77.4% -1.4

@chuangw6 chuangw6 requested a review from wlynch October 21, 2022 15:53
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 Oct 21, 2022
@tekton-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 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

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 21, 2022
@tekton-robot tekton-robot merged commit 83af002 into tektoncd:main Oct 21, 2022
chuangw6 added a commit to chuangw6/chains that referenced this pull request Oct 21, 2022
tekton-robot pushed a commit that referenced this pull request Oct 21, 2022
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. lgtm Indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants