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

v1: Rewrite OCI storage to use new interface #842

Merged
merged 3 commits into from
Jul 6, 2023

Conversation

wlynch
Copy link
Member

@wlynch wlynch commented Jun 26, 2023

Changes

This change is part of a larger effort for refactoring external facing libraries to make them easier to support for v1+: #780

This introduces a new signing interface using generics. This allows us to cut out much of the type switching and parameter plumbing by making the key fields that storers need to make decisions on how to store signatures / attestations:

  1. The original tekton object
  2. The artifact we extracted from the tekton object
  3. The formatted object we transformed the artifact into
  4. The signature/cert details

This change marks the existing Backend implementation as deprecated, but is intended to be backwards compatible and still supported for the time being. There should be no change in user behavior.

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

NONE

@tekton-robot tekton-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Jun 26, 2023
@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/storage/oci/attestation.go Do not exist 71.0%
pkg/chains/storage/oci/legacy.go Do not exist 37.7%
pkg/chains/storage/oci/simple.go Do not exist 69.0%

@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/storage/oci/attestation.go Do not exist 71.0%
pkg/chains/storage/oci/legacy.go Do not exist 37.7%
pkg/chains/storage/oci/simple.go Do not exist 69.0%

@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/storage/oci/attestation.go Do not exist 71.0%
pkg/chains/storage/oci/legacy.go Do not exist 37.7%
pkg/chains/storage/oci/simple.go Do not exist 69.0%

Copy link
Contributor

@lcarva lcarva left a comment

Choose a reason for hiding this comment

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

Love these changes! Just left a couple of minor comments.

## Signables

At it's core, Chains is basically an ETL pipeline. We Extract artifacts from run
objects, Transform and sign them, then Load them into storage.
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a good explanation. It would be great to show how they map to the Signable, Payloader, Signer and Storer interfaces below.

I think you mean something like this: We Extract artifacts from run objects (Signable), Transform (Payloader) and sign (Signer) them, then Load them into storage (Storer). If so, that makes perfect sense to me.

Maybe in the future, we may want to rename these interfaces. Signer and Storer are clear. Signable is confusing because it has nothing to do with signing - maybe Extractor? Payloader is a bit ambiguous - Transformer then Transformer.Transform? I'm nitpicking. Just trying to make this easier for newcomers to understand.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah I agree. I'm somewhat biasing on existing interface names at the moment. Happy to rename these (though probably in a separate PR).

docs/v1-proposal.md Show resolved Hide resolved
go.mod Outdated Show resolved Hide resolved
pkg/chains/storage/oci/attestation.go Outdated Show resolved Hide resolved
pkg/chains/storage/oci/attestation.go Outdated Show resolved Hide resolved
pkg/chains/storage/oci/attestation.go Show resolved Hide resolved
pkg/chains/storage/oci/simple.go Outdated Show resolved Hide resolved
@tekton-robot tekton-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 27, 2023
@tekton-robot tekton-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 6, 2023
@wlynch wlynch requested a review from lcarva July 6, 2023 15:34
@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/storage/oci/attestation.go Do not exist 60.0%
pkg/chains/storage/oci/legacy.go Do not exist 37.7%
pkg/chains/storage/oci/simple.go Do not exist 62.5%

var repo *name.Repository
if r := cfg.Storage.OCI.Repository; r != "" {
var opts []name.Option
if cfg.Storage.OCI.Insecure {
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe this should be moved outside of the outer if-block. At least today, this config option applies to any repo, not just Storage.OCI.Repository.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's a bit confusing, but this was already happening outside of this block - this was only handling the "you asked us to store the objects in another repo" resolution.

I agree this isn't super clear though, so refactored this a bit more to try and consolidate this (and as an added bonus, removed the need to pass config.Config in!)

@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/storage/oci/attestation.go Do not exist 60.0%
pkg/chains/storage/oci/legacy.go Do not exist 37.7%
pkg/chains/storage/oci/simple.go Do not exist 62.5%

Removes the need to take in a config object.
@wlynch wlynch requested a review from lcarva July 6, 2023 16:57
@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/storage/oci/attestation.go Do not exist 80.0%
pkg/chains/storage/oci/legacy.go Do not exist 37.7%
pkg/chains/storage/oci/options.go Do not exist 100.0%
pkg/chains/storage/oci/simple.go Do not exist 81.5%

@tekton-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lcarva

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 Jul 6, 2023
@lcarva
Copy link
Contributor

lcarva commented Jul 6, 2023

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 6, 2023
@tekton-robot tekton-robot removed the lgtm Indicates that a PR is ready to be merged. label Jul 6, 2023
@lcarva
Copy link
Contributor

lcarva commented Jul 6, 2023

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 6, 2023
@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/storage/oci/attestation.go Do not exist 80.0%
pkg/chains/storage/oci/legacy.go Do not exist 37.7%
pkg/chains/storage/oci/options.go Do not exist 100.0%
pkg/chains/storage/oci/simple.go Do not exist 81.5%

@tekton-robot tekton-robot merged commit 2eb21be into tektoncd:main Jul 6, 2023
11 checks passed
@lcarva lcarva mentioned this pull request Nov 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. lgtm Indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants