Skip to content

Issue 642: predicate.materials needs to record more information in TaskRun#649

Merged
tekton-robot merged 1 commit into
tektoncd:mainfrom
chitrangpatel:add-step-sidecar-image-details-in-predicate-material
Jan 9, 2023
Merged

Issue 642: predicate.materials needs to record more information in TaskRun#649
tekton-robot merged 1 commit into
tektoncd:mainfrom
chitrangpatel:add-step-sidecar-image-details-in-predicate-material

Conversation

@chitrangpatel

@chitrangpatel chitrangpatel commented Dec 19, 2022

Copy link
Copy Markdown
Contributor

This PR addresses issue #642 by adding steps and sidecars image uri and digest information to predicate.materials for a TaskRun. Predicate.materials for PipelineRun are addressed in #658.

Changes

  • Refactoring: materials was pulled out from taskrun.go into its own module like buildconfig.go : material.go
  • Added logic to extract image uri and digest from imageID of steps and sidecars of taskrunobject.

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

predicate.materials includes image uri and digest information from all steps and sidecars.

@tekton-robot tekton-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Dec 19, 2022
@chitrangpatel

Copy link
Copy Markdown
Contributor Author

/kind bug

@tekton-robot tekton-robot added the kind/bug Categorizes issue or PR as related to a bug. label Dec 19, 2022
@tekton-robot

Copy link
Copy Markdown

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/material.go Do not exist 86.1%
pkg/chains/formats/intotoite6/taskrun/taskrun.go 76.7% 71.4% -5.3

@chitrangpatel chitrangpatel force-pushed the add-step-sidecar-image-details-in-predicate-material branch from 5871209 to 40955d1 Compare December 19, 2022 19:50
@tekton-robot

Copy link
Copy Markdown

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/material.go Do not exist 86.1%
pkg/chains/formats/intotoite6/taskrun/taskrun.go 76.7% 71.4% -5.3

@chuangw6 chuangw6 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @chitrangpatel!

Comment thread pkg/chains/formats/intotoite6/taskrun/material.go Outdated
Comment thread pkg/chains/formats/intotoite6/taskrun/material_test.go Outdated
Comment thread pkg/chains/formats/intotoite6/taskrun/material.go
Comment thread pkg/chains/formats/intotoite6/taskrun/material_test.go Outdated
Comment thread pkg/chains/formats/intotoite6/taskrun/material_test.go Outdated
Comment thread pkg/chains/formats/intotoite6/taskrun/material_test.go Outdated
Comment thread pkg/chains/formats/intotoite6/taskrun/material.go Outdated
Comment thread pkg/chains/formats/intotoite6/taskrun/material.go Outdated
Comment thread pkg/chains/formats/intotoite6/taskrun/material.go Outdated
Comment thread pkg/chains/formats/intotoite6/taskrun/material.go Outdated
@tekton-robot

Copy link
Copy Markdown

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/pipelinerun/pipelinerun.go 79.2% 78.3% -0.9
pkg/chains/formats/intotoite6/taskrun/material.go Do not exist 86.1%
pkg/chains/formats/intotoite6/taskrun/taskrun.go 76.7% 71.4% -5.3

@chitrangpatel chitrangpatel force-pushed the add-step-sidecar-image-details-in-predicate-material branch from 67d312e to 1e0a3c3 Compare December 20, 2022 16:33
@tekton-robot

Copy link
Copy Markdown

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/material.go Do not exist 84.1%
pkg/chains/formats/intotoite6/taskrun/taskrun.go 76.7% 62.5% -14.2

@chitrangpatel chitrangpatel force-pushed the add-step-sidecar-image-details-in-predicate-material branch from 1e0a3c3 to 8cd6294 Compare December 20, 2022 17:51
@tekton-robot tekton-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Dec 20, 2022
@tekton-robot

Copy link
Copy Markdown

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/material.go Do not exist 84.1%
pkg/chains/formats/intotoite6/taskrun/taskrun.go 76.7% 62.5% -14.2

@chitrangpatel chitrangpatel force-pushed the add-step-sidecar-image-details-in-predicate-material branch from 8cd6294 to 645f946 Compare December 20, 2022 17:57
@tekton-robot

Copy link
Copy Markdown

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/material.go Do not exist 84.1%
pkg/chains/formats/intotoite6/taskrun/taskrun.go 76.7% 62.5% -14.2

@chitrangpatel chitrangpatel force-pushed the add-step-sidecar-image-details-in-predicate-material branch from 645f946 to b123506 Compare December 20, 2022 18:58
@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 Dec 20, 2022
@tekton-robot

Copy link
Copy Markdown

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/material.go Do not exist 84.1%
pkg/chains/formats/intotoite6/taskrun/taskrun.go 76.7% 62.5% -14.2

@chitrangpatel

Copy link
Copy Markdown
Contributor Author

/retest

Comment thread pkg/chains/formats/intotoite6/taskrun/material.go
Comment thread pkg/chains/formats/intotoite6/taskrun/material_test.go Outdated
Comment thread pkg/chains/formats/intotoite6/taskrun/material.go Outdated
@chitrangpatel chitrangpatel force-pushed the add-step-sidecar-image-details-in-predicate-material branch from b123506 to fa40296 Compare December 21, 2022 17:15
@tekton-robot tekton-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Dec 21, 2022
@tekton-robot

Copy link
Copy Markdown

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/material.go Do not exist 84.1%
pkg/chains/formats/intotoite6/taskrun/taskrun.go 76.7% 62.5% -14.2

@chitrangpatel chitrangpatel force-pushed the add-step-sidecar-image-details-in-predicate-material branch from fa40296 to fbf249e Compare December 21, 2022 19:17
@tekton-robot

Copy link
Copy Markdown

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/material.go Do not exist 83.5%
pkg/chains/formats/intotoite6/taskrun/taskrun.go 76.7% 62.5% -14.2

@chitrangpatel chitrangpatel force-pushed the add-step-sidecar-image-details-in-predicate-material branch from fbf249e to 96220a2 Compare December 21, 2022 19:45
@tekton-robot

Copy link
Copy Markdown

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/material.go Do not exist 83.5%
pkg/chains/formats/intotoite6/taskrun/taskrun.go 76.7% 62.5% -14.2

@chitrangpatel

Copy link
Copy Markdown
Contributor Author

/retest

@chitrangpatel chitrangpatel force-pushed the add-step-sidecar-image-details-in-predicate-material branch from 96220a2 to 8d0d9e9 Compare December 21, 2022 22:20
@tekton-robot

Copy link
Copy Markdown

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/material.go Do not exist 83.5%
pkg/chains/formats/intotoite6/taskrun/taskrun.go 76.7% 62.5% -14.2

@chitrangpatel chitrangpatel force-pushed the add-step-sidecar-image-details-in-predicate-material branch from 8d0d9e9 to cf79e26 Compare December 22, 2022 15:06
@tekton-robot

Copy link
Copy Markdown

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/material.go Do not exist 83.5%
pkg/chains/formats/intotoite6/taskrun/taskrun.go 76.7% 62.5% -14.2

@chitrangpatel chitrangpatel force-pushed the add-step-sidecar-image-details-in-predicate-material branch from cf79e26 to a3b75a9 Compare December 22, 2022 16:10
@tekton-robot

Copy link
Copy Markdown

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/material.go Do not exist 83.5%
pkg/chains/formats/intotoite6/taskrun/taskrun.go 76.7% 62.5% -14.2

Comment thread pkg/chains/formats/intotoite6/taskrun/material.go Outdated
Comment thread pkg/chains/formats/intotoite6/taskrun/material.go Outdated
Comment thread pkg/chains/formats/intotoite6/taskrun/material.go Outdated
Comment thread pkg/chains/formats/intotoite6/intotoite6_test.go Outdated
Comment thread test/examples_test.go Outdated
@chitrangpatel chitrangpatel force-pushed the add-step-sidecar-image-details-in-predicate-material branch from a3b75a9 to 3c06a56 Compare December 22, 2022 18:42
@tekton-robot

Copy link
Copy Markdown

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/material.go Do not exist 84.1%
pkg/chains/formats/intotoite6/taskrun/taskrun.go 76.7% 62.5% -14.2

@chitrangpatel chitrangpatel force-pushed the add-step-sidecar-image-details-in-predicate-material branch from 3c06a56 to da5d864 Compare December 22, 2022 19:00
@tekton-robot

Copy link
Copy Markdown

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/material.go Do not exist 84.1%
pkg/chains/formats/intotoite6/taskrun/taskrun.go 76.7% 62.5% -14.2

@chitrangpatel chitrangpatel force-pushed the add-step-sidecar-image-details-in-predicate-material branch from da5d864 to f8c9604 Compare December 22, 2022 19:39
This PR addressed issue tektoncd#642
by adding step and sidecar image uri and digest information to
`predicate.materials` for a `TaskRun`. A follow-up PR will be created to address materials for `PipelineRun`.
@chitrangpatel chitrangpatel force-pushed the add-step-sidecar-image-details-in-predicate-material branch from f8c9604 to d326d90 Compare December 22, 2022 19:43
@tekton-robot

Copy link
Copy Markdown

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/internal/material/material.go Do not exist 90.0%
pkg/chains/formats/intotoite6/taskrun/material.go Do not exist 83.3%
pkg/chains/formats/intotoite6/taskrun/taskrun.go 76.7% 62.5% -14.2

@chitrangpatel chitrangpatel requested a review from wlynch December 22, 2022 20:31

@wlynch wlynch left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/lgtm

One minor nit.

Comment on lines +39 to +59
func AddStepImagesToMaterials(steps []v1beta1.StepState, mats *[]slsa.ProvenanceMaterial) error {
for _, stepState := range steps {
if err := AddImageIDToMaterials(stepState.ImageID, mats); err != nil {
return err
}
}
return nil
}

// AddSidecarImagesToMaterials adds sidecar images to predicate.materials
func AddSidecarImagesToMaterials(sidecars []v1beta1.SidecarState, mats *[]slsa.ProvenanceMaterial) error {
for _, sidecarState := range sidecars {
if err := AddImageIDToMaterials(sidecarState.ImageID, mats); err != nil {
return err
}
}
return nil
}

// AddImageIDToMaterials converts an imageId with format <uri>@sha256:<digest> and then adds it to a provenance materials.
func AddImageIDToMaterials(imageID string, mats *[]slsa.ProvenanceMaterial) error {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let's unexport these.

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 9, 2023
@tekton-robot

Copy link
Copy Markdown

[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

Details 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 Jan 9, 2023
@tekton-robot tekton-robot merged commit 1d48332 into tektoncd:main Jan 9, 2023
@wlynch wlynch mentioned this pull request Jan 9, 2023
6 tasks
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/bug Categorizes issue or PR as related to a bug. 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