Introduce Resolved dependencies for SLSA v1.0 predicate#798
Introduce Resolved dependencies for SLSA v1.0 predicate#798tekton-robot merged 1 commit intotektoncd:mainfrom
Conversation
b7b1b89 to
8a9594a
Compare
|
The following is the coverage report on the affected files.
|
4ed12fc to
99261ab
Compare
|
The following is the coverage report on the affected files.
|
99261ab to
5b4ba18
Compare
|
The following is the coverage report on the affected files.
|
chuangw6
left a comment
There was a problem hiding this comment.
Thank you @chitrangpatel for kicking off the implementation of SLSA v1.0 support!!!
pkg/chains/formats/slsa/v2alpha2/internal/resolved_dependencies/resolved_dependencies.go
Outdated
Show resolved
Hide resolved
pkg/chains/formats/slsa/v2alpha2/internal/resolved_dependencies/resolved_dependencies.go
Outdated
Show resolved
Hide resolved
pkg/chains/formats/slsa/v2alpha2/internal/resolved_dependencies/resolved_dependencies.go
Outdated
Show resolved
Hide resolved
5b4ba18 to
e238bd2
Compare
|
The following is the coverage report on the affected files.
|
e238bd2 to
7cedd97
Compare
|
The following is the coverage report on the affected files.
|
pkg/chains/formats/slsa/v2alpha2/internal/resolved_dependencies/resolved_dependencies.go
Outdated
Show resolved
Hide resolved
pkg/chains/formats/slsa/v2alpha2/internal/resolved_dependencies/resolved_dependencies.go
Outdated
Show resolved
Hide resolved
pkg/chains/formats/slsa/v2alpha2/internal/resolved_dependencies/resolved_dependencies.go
Outdated
Show resolved
Hide resolved
pkg/chains/formats/slsa/v2alpha2/internal/resolved_dependencies/resolved_dependencies.go
Outdated
Show resolved
Hide resolved
pkg/chains/formats/slsa/v2alpha2/internal/resolved_dependencies/resolved_dependencies.go
Outdated
Show resolved
Hide resolved
pkg/chains/formats/slsa/v2alpha2/internal/resolved_dependencies/resolved_dependencies.go
Outdated
Show resolved
Hide resolved
pkg/chains/formats/slsa/v2alpha2/internal/resolved_dependencies/resolved_dependencies.go
Outdated
Show resolved
Hide resolved
pkg/chains/formats/slsa/v2alpha2/internal/resolved_dependencies/resolved_dependencies.go
Outdated
Show resolved
Hide resolved
pkg/chains/formats/slsa/v2alpha2/internal/resolved_dependencies/resolved_dependencies.go
Show resolved
Hide resolved
pkg/chains/formats/slsa/v2alpha2/internal/resolved_dependencies/resolved_dependencies.go
Show resolved
Hide resolved
pkg/chains/formats/slsa/v2alpha2/internal/resolved_dependencies/resolved_dependencies.go
Show resolved
Hide resolved
pkg/chains/formats/slsa/v2alpha2/internal/resolved_dependencies/resolved_dependencies.go
Outdated
Show resolved
Hide resolved
pkg/chains/formats/slsa/v2alpha2/internal/resolved_dependencies/resolved_dependencies.go
Outdated
Show resolved
Hide resolved
pkg/chains/formats/slsa/v2alpha2/internal/resolved_dependencies/resolved_dependencies.go
Outdated
Show resolved
Hide resolved
bdd3afe to
b81fb75
Compare
There was a problem hiding this comment.
Thank you @chitrangpatel for the refactor! Much cleaner now!
One general comment I have is that it would be great if we can have a consistent way to collect the list of materials/resolvedDependencies throughout the helper functions.
Currently, there are three categories:
- some functions just receive
*[]common.ProvenanceMaterialsas an argument and mutate it. - some receive the
[]common.ProvenanceMaterialsbut also return[]common.ProvenanceMaterials - som functions just return a new
[]common.ProvenanceMaterialswithout receiving a list of materials.
pkg/chains/formats/slsa/v2alpha2/internal/resolved_dependencies/resolved_dependencies.go
Outdated
Show resolved
Hide resolved
pkg/chains/formats/slsa/v2alpha2/internal/resolved_dependencies/resolved_dependencies.go
Outdated
Show resolved
Hide resolved
pkg/chains/formats/slsa/v2alpha2/internal/resolved_dependencies/resolved_dependencies.go
Outdated
Show resolved
Hide resolved
pkg/chains/formats/slsa/v2alpha2/internal/resolved_dependencies/resolved_dependencies.go
Outdated
Show resolved
Hide resolved
pkg/chains/formats/slsa/v2alpha2/internal/resolved_dependencies/resolved_dependencies.go
Outdated
Show resolved
Hide resolved
pkg/chains/formats/slsa/v2alpha2/internal/resolved_dependencies/resolved_dependencies_test.go
Outdated
Show resolved
Hide resolved
pkg/chains/formats/slsa/v2alpha2/internal/resolved_dependencies/resolved_dependencies_test.go
Outdated
Show resolved
Hide resolved
|
The following is the coverage report on the affected files.
|
Thats a good idea. Since its a lot of refactoring, I suggest we do this in a followup PR since it does not fit well with this. |
da261c3 to
d84a8a8
Compare
|
The following is the coverage report on the affected files.
|
d84a8a8 to
a458fb2
Compare
|
The following is the coverage report on the affected files.
|
a458fb2 to
bd46e56
Compare
|
The following is the coverage report on the affected files.
|
bd46e56 to
2e25eaf
Compare
|
The following is the coverage report on the affected files.
|
lcarva
left a comment
There was a problem hiding this comment.
/lgtm
Left a couple of minor comments that are non-blocking.
| mats := []common.ProvenanceMaterial{} | ||
|
|
||
| // add step and sidecar images | ||
| if err := material.AddStepImagesToMaterials(tro.Status.Steps, &mats); err != nil { |
There was a problem hiding this comment.
I'm a bit concerned that some of the functions in material take a pointer address to a materials slice, like this one, for two reasons:
- It seems bad practice to pass a slice pointer around.
- Other functions on the
materialspackage deal with adding things to materials but don't take a pre-existing slice, e.g.AddMaterialsFromTaskParamsAndResults.
How about something like this?
allMaterials := []common.ProvenanceMaterial{}
mats, err := material.FromStepImages(tro.Status.Steps)
if err != nil {...}
allMaterials = append(allMaterials, mats...)
There was a problem hiding this comment.
Agreed! @chuangw6 pointed this out as well. But its better left as its own cleanup PR which I will do after this.
This PR introduces resolved dependencies for the SLSAv1.0 predicate. It addresses part of issue tektoncd#797
2e25eaf to
d814bdf
Compare
|
@lcarva could you please lgtm it again? I implemented the nits you mentioned. Thanks! |
|
The following is the coverage report on the affected files.
|
|
/lgtm @wlynch, it looks like your comments have been addressed. Ok to merge this? (I'll hold off my approval for now) |
wlynch
left a comment
There was a problem hiding this comment.
final nits, but I'll lgtm so we can get this in since we know there's other cleanup we want to do.
Thanks for making those changes. 🎉
/lgtm
|
|
||
| func checkDigest(dig string) error { | ||
| // ParseDigest parses the digest string and returns the algorithm and hex section of the digest. | ||
| func ParseDigest(dig string) (algo_string string, hex string, err error) { |
| for _, input := range tro.Spec.Resources.Inputs { //nolint:all //incompatible with pipelines v0.45 | ||
| if input.ResourceSpec == nil || input.ResourceSpec.Type != backport.PipelineResourceTypeGit { //nolint:all //incompatible with pipelines v0.45 |
There was a problem hiding this comment.
nit
| for _, input := range tro.Spec.Resources.Inputs { //nolint:all //incompatible with pipelines v0.45 | |
| if input.ResourceSpec == nil || input.ResourceSpec.Type != backport.PipelineResourceTypeGit { //nolint:all //incompatible with pipelines v0.45 | |
| for _, input := range tro.Spec.Resources.Inputs { //nolint:all // needed for pipelines < v0.45 | |
| if input.ResourceSpec == nil || input.ResourceSpec.Type != backport.PipelineResourceTypeGit { //nolint:all // needed for pipelines < v0.45 |
|
[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 DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Changes
This PR introduces resolved dependencies for the SLSAv1.0 predicate.
It addresses part of issue #797
Related design.
Submitter Checklist
As the author of this PR, please check off the items in this checklist:
functionality, content, code)
Release Notes
/kind feature