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

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

Merged
merged 1 commit into from
Jan 31, 2023

Conversation

EmmaMunley
Copy link
Contributor

@EmmaMunley EmmaMunley commented Jan 27, 2023

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 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

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

@@ -68,8 +68,10 @@ func publicKeyOrCert(signer signing.Signer, cert string) ([]byte, error) {
return pem, nil
}

// 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
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
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

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

@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/signing.go 73.3% 73.6% 0.3

@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

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
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.

Just a small nit.

if err != nil {
return err
}
var rekorClient rekorClient
Copy link
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.

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.

/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
Member

/retest

Moved the initalization of rekorClient to be gated inside the shouldUploadTlog function to ensure transparency is enabled
@tekton-robot tekton-robot removed the lgtm Indicates that a PR is ready to be merged. label Jan 30, 2023
@EmmaMunley
Copy link
Contributor Author

EmmaMunley commented Jan 31, 2023

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.

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.

/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

[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

@lcarva
Copy link
Contributor

lcarva commented Jan 31, 2023

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
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