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

[TEP-0091] add VerificationResult #6663

Merged
merged 1 commit into from
May 16, 2023

Conversation

Yongxuanzhang
Copy link
Member

@Yongxuanzhang Yongxuanzhang commented May 15, 2023

Changes

The commit adds VerificationResult struct, the new struct has 2 fields, VerificationResultType and Err.
VerificationResultType has 4 types: VerificationSkip, VerificationPass,
VerificationWarn, VerificationError.

VerificationResult will be used in reconciler to update taskrun, pipelinerun conditions, conditions' message will be filled with Err from VerificationResult.

This PR is a split from #6654.

/kind feature

Signed-off-by: Yongxuan Zhang [email protected]

Submitter Checklist

As the author of this PR, please check off the items in this checklist:

  • Has Docs if any changes are user facing, including updates to minimum requirements e.g. Kubernetes version bumps
  • Has Tests included if any functionality added or changed
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including functionality, content, code)
  • Has a kind label. You can add one by adding a comment on this PR that contains /kind <type>. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tep
  • Release notes block below has been updated with any user facing changes (API changes, bug fixes, changes requiring upgrade notices or deprecation warnings). See some examples of good release notes.
  • 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 kind/feature Categorizes issue or PR as related to a new feature. release-note-none Denotes a PR that doesnt merit a release note. labels May 15, 2023
@tekton-robot tekton-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label May 15, 2023
@Yongxuanzhang
Copy link
Member Author

/test check-pr-has-kind-label

@tekton-robot
Copy link
Collaborator

@Yongxuanzhang: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test pull-tekton-pipeline-alpha-integration-tests
  • /test pull-tekton-pipeline-beta-integration-tests
  • /test pull-tekton-pipeline-build-tests
  • /test pull-tekton-pipeline-integration-tests
  • /test tekton-pipeline-unit-tests

The following commands are available to trigger optional jobs:

  • /test pull-tekton-pipeline-go-coverage

Use /test all to run all jobs.

In response to this:

/test check-pr-has-kind-label

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

pkg/trustedresources/verify.go Outdated Show resolved Hide resolved
pkg/trustedresources/verify.go Outdated Show resolved Hide resolved
// 3) VerificationPass: The verification passes.
// 4) WarnModeVerificationFail: Only Warn mode verification policies fail.
VerificationResultType VerificationResultType
// Message contains the warning message when there is a warning logged.
Copy link
Member

Choose a reason for hiding this comment

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

just curious, is this a k8s style "Reason" e.g. "NoMatchingVerificationPolicies" or meant to be human-readable?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think this meant to be human-readable, my plan is to update the condition message with this message

@Yongxuanzhang
Copy link
Member Author

/assign @lbernick

@Yongxuanzhang
Copy link
Member Author

/assign @chuangw6

@@ -41,6 +41,30 @@ const (
SignatureAnnotation = "tekton.dev/signature"
)

const (
IgnoreWhenNoMatchPolicy = iota
Copy link
Member

Choose a reason for hiding this comment

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

Suggest more consistency in naming, e.g.

NoMatchingPoliciesIgnore
NoMatchingPoliciesWarn
NoMatchingPoliciesError
VerificationWarning
VerificationFailed
VerificationPassed

Also I think we still need a mode for no matching policies + failure?

Copy link
Member Author

Choose a reason for hiding this comment

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

no matching policies + failure belongs to VerificationError, all previous returned error cases go into this case since we don't need to have different types for them, there will be only 1 case when updating the condition.

Copy link
Member Author

@Yongxuanzhang Yongxuanzhang May 16, 2023

Choose a reason for hiding this comment

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

How about this?

VerificationError
VerificationWarn
VerificationSuccess
VerificationSkip

I realized that NoMatchingPoliciesWarn and WarnModeVerificationFail are actually the same case when updating the condition

Copy link
Member

Choose a reason for hiding this comment

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

My 2c:
what result mode we need here depends on what the tekton controller will be doing with different verification result and what level of details we want to surface to the users. @Yongxuanzhang Can you please add some details to the PR description about that?

// 2) VerificationPass: The verification passed. Err is nil in this case.
// 3) VerificationWarn: A warning is logged. It could be no matching policies and feature flag "trusted-resources-verification-no-match-policy" is warn,
// or only Warn mode verification policies fail.
// 4) VerificationError: The verification failed, it could be the signature doesn't match the public key or there are errors during verification.
Copy link
Member

Choose a reason for hiding this comment

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

This could also happen if there are no matching policies and "no-match-policy" is set to "fail" right?

Copy link
Member Author

Choose a reason for hiding this comment

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

ah yes, I missed that case, will add now

@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lbernick

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 May 16, 2023
The commit adds VerificationResult struct, the new struct has 2 fields, VerificationResultType and Err.
VerificationResultType has 4 types: VerificationSkip, VerificationPass,
VerificationWarn, VerificationError.

VerificationResult will be used in reconciler to update taskrun, pipelinerun conditions.

Signed-off-by: Yongxuan Zhang [email protected]
@chuangw6
Copy link
Member

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label May 16, 2023
@Yongxuanzhang
Copy link
Member Author

Yongxuanzhang commented May 16, 2023

@lbernick
Copy link
Member

@Yongxuanzhang
Copy link
Member Author

/retest
a possible flaky test? https://prow.tekton.dev/view/gs/tekton-prow/pr-logs/pull/tektoncd_pipeline/6663/pull-tekton-pipeline-alpha-integration-tests/1658558758315364352

Could you create an issue to track the flake?

Sure, I'm trying to check the logs and see what could be the issue, but still no idea. It seems that we're experiencing more flaky tests recently?

@Yongxuanzhang
Copy link
Member Author

/test pull-tekton-pipeline-go-coverage-df

@tekton-robot
Copy link
Collaborator

@Yongxuanzhang: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test pull-tekton-pipeline-alpha-integration-tests
  • /test pull-tekton-pipeline-beta-integration-tests
  • /test pull-tekton-pipeline-build-tests
  • /test pull-tekton-pipeline-integration-tests
  • /test tekton-pipeline-unit-tests

The following commands are available to trigger optional jobs:

  • /test pull-tekton-pipeline-go-coverage

Use /test all to run all jobs.

In response to this:

/test pull-tekton-pipeline-go-coverage-df

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@tekton-robot tekton-robot merged commit 5abf7c2 into tektoncd:main May 16, 2023
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/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesnt merit a release note. 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