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

OCPNODE-2596: Add SigstoreImageVerification e2e tests #29530

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

QiWang19
Copy link
Member

@QiWang19 QiWang19 commented Feb 6, 2025

This PR adds e2e tests for Clusterimagepolicy and imagepolicy (SigstoreImageVerification tech preview featuregate)

@QiWang19 QiWang19 changed the title Add SigstoreImageVerification e2e tests OCPNODE-2596: Add SigstoreImageVerification e2e tests Feb 6, 2025
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Feb 6, 2025
@openshift-ci-robot
Copy link

openshift-ci-robot commented Feb 6, 2025

@QiWang19: This pull request references OCPNODE-2596 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.19.0" version, but no target version was set.

In response to this:

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 openshift-eng/jira-lifecycle-plugin repository.

@QiWang19
Copy link
Member Author

QiWang19 commented Feb 7, 2025

@lyman9966 Could you help review the tests? I added some e2e according to the featuregate test requirement: https://github.com/openshift/api/blob/master/README.md#defining-featuregate-e2e-tests

@QiWang19 QiWang19 force-pushed the imgpolicy-sigstore-verification branch from 81d3b9b to b0a8122 Compare February 8, 2025 01:36
@QiWang19 QiWang19 marked this pull request as draft February 8, 2025 01:37
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 8, 2025
@QiWang19 QiWang19 marked this pull request as ready for review February 8, 2025 01:38
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 8, 2025
@openshift-ci openshift-ci bot requested review from celebdor and djoshy February 8, 2025 01:39
@QiWang19 QiWang19 force-pushed the imgpolicy-sigstore-verification branch 2 times, most recently from 7c824e0 to 687c621 Compare February 8, 2025 18:39
Signed-off-by: Qi Wang <qiwan@redhat.com>
@QiWang19 QiWang19 force-pushed the imgpolicy-sigstore-verification branch from 687c621 to 029f94e Compare February 9, 2025 19:10
@QiWang19
Copy link
Member Author

QiWang19 commented Feb 9, 2025

/test e2e-aws-ovn-single-node-techpreview-serial

@openshift-ci-robot
Copy link

openshift-ci-robot commented Feb 10, 2025

@QiWang19: This pull request references OCPNODE-2596 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.19.0" version, but no target version was set.

In response to this:

This PR adds e2e tests for Clusterimagepolicy and imagepolicy (SigstoreImageVerification tech preview featuregate)

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 openshift-eng/jira-lifecycle-plugin repository.

@QiWang19
Copy link
Member Author

/test e2e-aws-ovn-techpreview-serial
/test e2e-gcp-ovn-techpreview-serial

@saschagrunert
Copy link
Member

/retest

func createClusterImagePolicy(oc *exutil.CLI, fixture string) {
err := oc.Run("create").Args("-f", fixture).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
time.Sleep(10 * time.Second)
Copy link
Member

Choose a reason for hiding this comment

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

For what do we need the sleep here and below?

Copy link
Member Author

Choose a reason for hiding this comment

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

This sleep waits for the MachineConfigPool status to change to Updating. There is a delay in the status change after the CR is created.

Copy link
Contributor

@djoshy djoshy Feb 13, 2025

Choose a reason for hiding this comment

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

That's interesting! we don't need this delay in the MCO e2es, but perhaps the oc library is faster/slower for some reason.

name: public-key-rekor-image-policy
spec:
scopes:
- quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:4db234f37ae6712e2f7ed8d13f7fb49971c173d0e4f74613d0121672fa2e01f5

Choose a reason for hiding this comment

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

Is the image "quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:XXXX" signed by sigstore signature ? I remembered this kind of image can't pass signature verification during previous test. The pod can start successfully due to the default image policy "insecureAcceptAnything"

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, they are signed by sigstore signature. The image policy insecureAcceptAnything is used when there's no policy enforced on the specific image scope. Once the policy for the specific image scope is applied correctly, the image will be verified using the policy.

$ cosign verify quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:714a42e9eb52ef1bae8a2575ca1a2bfdf733d5a6786f08ceb3b6ff61d59931cf --key cosign.pub  --insecure-ignore-tlog=true
WARNING: Skipping tlog verification is an insecure practice that lacks of transparency and auditability verification for the signature.

Verification for quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:714a42e9eb52ef1bae8a2575ca1a2bfdf733d5a6786f08ceb3b6ff61d59931cf --
The following checks were performed on each of these signatures:
  - The cosign claims were validated
  - The signatures were verified against the specified public key

[{"critical":{"identity":{"docker-reference":"quay.io/openshift-release-dev/ocp-v4.0-art-dev"},"image":{"docker-manifest-digest":"sha256:714a42e9eb52ef1bae8a2575ca1a2bfdf733d5a6786f08ceb3b6ff61d59931cf"},"type":"cosign container image signature"},"optional":null}]

// included the given mcName in its config, and returns the new
// rendered config name.
func WaitForRenderedConfig(oc *exutil.CLI, pool, mcName string) (string, error) {
return WaitForRenderedConfigs(oc, pool, mcName)

Choose a reason for hiding this comment

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

Maybe I'm not familiar with the logic here. Since the parameter "mcName" in func WaitForRenderedConfig is a string type, why do you realize a new func WaitForRenderedConfigs and treat this parameter as ...string type.
Of course you can keep them there, just be confusing.

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 borrowed this function from MCO e2e test package, I guess there might be callers who directly use this method with multiple mcName.
I would also let folks from MCO review.

Choose a reason for hiding this comment

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

Got it, that's okay.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for catching this! I think it is something that was missed when WaitForRenderedConfigs was first added, we'll try to clean it up in the MCO repo.

Copy link

openshift-trt bot commented Feb 12, 2025

Job Failure Risk Analysis for sha: 029f94e

Job Name Failure Risk
pull-ci-openshift-origin-master-okd-scos-e2e-aws-ovn High
[sig-arch] Only known images used by tests
This test has passed 100.00% of 25 runs on jobs [periodic-ci-openshift-release-master-ci-4.19-e2e-aws-ovn] in the last 14 days.

Copy link
Contributor

openshift-ci bot commented Feb 12, 2025

@QiWang19: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-aws-ovn-single-node-techpreview-serial 029f94e link false /test e2e-aws-ovn-single-node-techpreview-serial
ci/prow/e2e-vsphere-ovn-upi 029f94e link true /test e2e-vsphere-ovn-upi
ci/prow/okd-scos-e2e-aws-ovn 029f94e link false /test okd-scos-e2e-aws-ovn

Full PR test history. Your PR dashboard.

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-sigs/prow repository. I understand the commands that are listed here.

@lyman9966
Copy link

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Feb 13, 2025
@djoshy
Copy link
Contributor

djoshy commented Feb 13, 2025

lgtm from the MCO side. The helpers are used correctly.

@harche
Copy link
Contributor

harche commented Feb 13, 2025

/lgtm

Copy link
Contributor

openshift-ci bot commented Feb 13, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: harche, lyman9966, QiWang19
Once this PR has been reviewed and has the lgtm label, please assign xueqzhan for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants