tektoncd / chains

Supply Chain Security in Tekton Pipelines
Apache License 2.0
240 stars 125 forks source link

Calculate subjects per formatter #1132

Closed renzodavid9 closed 1 month ago

renzodavid9 commented 1 month ago

Fixes: #1133

Changes

The way v2alpha3 and v2alpha4 calculate the subjects are different; calling extract.RetrieveAllArtifactURIs to generate the subjects is wrong if using v2alpha4. This PR add a new method to the payload formatter that returns the subjects according to the logic of each version. It also changes grafeas backend to generate the subject through the payloader and not calling the extract.RetrieveAllArtifactURIs directly.

Submitter Checklist

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

tekton-robot commented 1 month ago

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

renzodavid9 commented 1 month ago

/test all

tekton-robot commented 1 month ago

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/format.go 16.7% 20.0% 3.3
pkg/chains/formats/format.go Do not exist 40.0%
pkg/chains/formats/format.go Do not exist 20.0%
pkg/chains/formats/format.go Do not exist 20.0%
pkg/chains/formats/format.go Do not exist 33.3%
pkg/chains/formats/format.go Do not exist 16.7%
pkg/chains/formats/simple/simple.go 72.7% 66.7% -6.1
pkg/chains/formats/slsa/v1/intotoite6.go 30.8% 26.7% -4.1
pkg/chains/formats/slsa/v2alpha3/slsav2.go 87.5% 58.3% -29.2
pkg/chains/formats/slsa/v2alpha4/slsav2.go 75.0% 33.3% -41.7
pkg/chains/storage/grafeas/grafeas.go 78.2% 78.2% -0.0
tekton-robot commented 1 month ago

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/format.go 16.7% 20.0% 3.3
pkg/chains/formats/format.go Do not exist 35.0%
pkg/chains/formats/format.go Do not exist 20.0%
pkg/chains/formats/format.go Do not exist 20.0%
pkg/chains/formats/format.go Do not exist 33.3%
pkg/chains/formats/format.go Do not exist 16.7%
pkg/chains/formats/simple/simple.go 72.7% 66.7% -6.1
pkg/chains/formats/slsa/v1/intotoite6.go 30.8% 26.7% -4.1
pkg/chains/formats/slsa/v2alpha3/slsav2.go 87.5% 58.3% -29.2
pkg/chains/formats/slsa/v2alpha4/slsav2.go 75.0% 33.3% -41.7
pkg/chains/storage/grafeas/grafeas.go 78.2% 78.2% -0.0
chitrangpatel commented 1 month ago

/un-approve

chitrangpatel commented 1 month ago

/un-approve

chitrangpatel commented 1 month ago

/remove-approve

chitrangpatel commented 1 month ago

/lgtm

chitrangpatel commented 1 month ago

/lgtm

chitrangpatel commented 1 month ago

/approve

tekton-robot commented 1 month ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: chitrangpatel

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: - ~~[OWNERS](https://github.com/tektoncd/chains/blob/main/OWNERS)~~ [chitrangpatel] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
chitrangpatel commented 1 month ago

/kind bug

chitrangpatel commented 1 month ago

/cherry-pick release-v0.21.x

chitrangpatel commented 1 month ago

/cherry-pick release-v0.21.x