Skip to content

Do not initialize Rekor client if transparency is not enabled. Issue #520#693

Merged
tekton-robot merged 1 commit into
tektoncd:mainfrom
EmmaMunley:transparency-enabled
Jan 31, 2023
Merged

Do not initialize Rekor client if transparency is not enabled. Issue #520#693
tekton-robot merged 1 commit into
tektoncd:mainfrom
EmmaMunley:transparency-enabled

Conversation

@EmmaMunley

@EmmaMunley EmmaMunley commented Jan 27, 2023

Copy link
Copy Markdown
Contributor

Changes

Issue #520
Moved the initalization of rekorClient to be gated inside the shouldUploadTlog function to ensure transparency is enabled

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 requested review from lcarva and wlynch January 27, 2023 16:34
@tekton-robot tekton-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jan 27, 2023
@EmmaMunley EmmaMunley changed the title Do not initialize Rekor client if transparency is not enabled. #520 Do not initialize Rekor client if transparency is not enabled. Issue #520 Jan 27, 2023
@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/rekor.go 29.6% 44.8% 15.2

Comment thread pkg/chains/rekor.go Outdated

// for testing
var getRekor = func(url string, l *zap.SugaredLogger) (rekorClient, error) {
var getRekor = func(is_enabled bool, url string, l *zap.SugaredLogger) (rekorClient, error) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would it be more straight forward to only call getRekor if it is enabled since the caller already has that information?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Cool! I updated the PR and moved the client initialization to be gated inside the shouldUploadTlog function. Let me know if this looks good to you. Thanks!

@tekton-robot tekton-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 27, 2023
@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/signing.go 73.3% 73.6% 0.3

@EmmaMunley EmmaMunley force-pushed the transparency-enabled branch from 6be786b to 1b1466e Compare January 27, 2023 18:56
@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/signing.go 73.3% 73.6% 0.3

@EmmaMunley EmmaMunley force-pushed the transparency-enabled branch from 1b1466e to 41e093f Compare January 27, 2023 19:16
@tekton-robot tekton-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Jan 27, 2023
@EmmaMunley EmmaMunley force-pushed the transparency-enabled branch 2 times, most recently from 8d977e4 to 4de42ff Compare January 27, 2023 21:27
@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/signing.go 73.3% 73.6% 0.3

@EmmaMunley EmmaMunley requested review from lcarva and removed request for wlynch January 27, 2023 21:31

@lcarva lcarva left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just a small nit.

Comment thread pkg/chains/signing.go Outdated
if err != nil {
return err
}
var rekorClient rekorClient

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is there a benefit to declaring this variable this far from when it's actually used?

It could be useful to only have to call getRekor once during this method, but that doesn't seem to be the case here.

@EmmaMunley EmmaMunley force-pushed the transparency-enabled branch from 9fc5da7 to 9020a8d Compare January 30, 2023 14:47

@lcarva lcarva left a comment

Copy link
Copy Markdown
Contributor

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 lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jan 30, 2023
@jagathprakash

Copy link
Copy Markdown
Member

/retest

Moved the initalization of rekorClient to be gated inside the shouldUploadTlog function to ensure transparency is enabled
@EmmaMunley EmmaMunley force-pushed the transparency-enabled branch from 9020a8d to 55975ce Compare January 30, 2023 22:11
@tekton-robot tekton-robot removed the lgtm Indicates that a PR is ready to be merged. label Jan 30, 2023
@EmmaMunley EmmaMunley requested a review from lcarva January 31, 2023 18:16
@EmmaMunley

EmmaMunley commented Jan 31, 2023

Copy link
Copy Markdown
Contributor Author

FYI @lcarva: It looks like one the E2E tests is flaky and the only way to trigger retesting was to submit a new PR so I just fixed a typo in the readme and the tests are now passing.

@lcarva lcarva left a comment

Copy link
Copy Markdown
Contributor

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 Jan 31, 2023
@tekton-robot

Copy link
Copy Markdown

[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

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

@lcarva

lcarva commented Jan 31, 2023

Copy link
Copy Markdown
Contributor

FYI @lcarva: It looks like one the E2E tests is flaky and the only way to trigger retesting was to submit a new PR so I just fixed a type in the readme and the tests are now passing.

Bummer... If you managed to save some details about the failure, could you file an issue here? 🙏

@tekton-robot tekton-robot merged commit 3d0e739 into tektoncd:main Jan 31, 2023
@EmmaMunley

Copy link
Copy Markdown
Contributor Author

FYI @lcarva: It looks like one the E2E tests is flaky and the only way to trigger retesting was to submit a new PR so I just fixed a type in the readme and the tests are now passing.

Bummer... If you managed to save some details about the failure, could you file an issue here? 🙏

Sure, I opened an issue for this here

@EmmaMunley EmmaMunley deleted the transparency-enabled branch February 2, 2023 19:22
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/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants