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

CMP-2859: Resolve failing Image-stream-sets-schedule #12895

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

KaushikOP
Copy link

@KaushikOP KaushikOP commented Jan 24, 2025

Description:

  • Resolve failing Image-stream-sets-schedule. Changes to samples operator which were not accounted for, and ClusterVersion managed imagestreams should be excluded.

Rationale:

  • fixes failing rule

  • Fixes #CMP-2859

Review Hints:

  • Part of DISA-STIG profile for OCP

…ator and ClusterVersion

Signed-off-by: Kaushik Talathi <kaushik.talathi1@ibm.com>
@openshift-ci openshift-ci bot added the needs-ok-to-test Used by openshift-ci bot. label Jan 24, 2025
Copy link

openshift-ci bot commented Jan 24, 2025

Hi @KaushikOP. Thanks for your PR.

I'm waiting for a ComplianceAsCode member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@KaushikOP KaushikOP changed the title CMP2859: Resolve failing Image-stream-sets-schedule CMP-2859: Resolve failing Image-stream-sets-schedule Jan 24, 2025
@prb112
Copy link
Contributor

prb112 commented Jan 24, 2025

/jira-refresh

@@ -32,17 +32,17 @@ references:
srg: SRG-APP-000456-CTR-001125

{{% set api_path = '/apis/image.openshift.io/v1/imagestreams' %}}
{{% set jqfilter = '[.items[] | .spec.tags[]? | select(.from.kind != "ImageStreamTag") | (.importPolicy.scheduled != null and .importPolicy.scheduled != false)] | all' %}}
{{% set jqfilter = '[.items[] | select( .metadata.ownerReferences? // [] | all(.kind != "ClusterVersion")) | select(.metadata.labels[]? | select("samples.operator.openshift.io/managed: true") | not) | select(.spec.tags[]?.from.kind != "ImageStreamTag" and (.importPolicy.scheduled != null or .importPolicy.scheduled != false))] | any' %}}
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. Gather all ImageStreams - .items[]
  2. Select only those not managed by ClusterVersion - select( .metadata.ownerReferences? // [] | all(.kind != "ClusterVersion"))
  • ClusterVersion implies on upgrade that these ImageStream entries are upgraded
  1. From those that remain, check if it's managed by the Samples Operator, if so ignore those - select(.metadata.labels[]? | select("samples.operator.openshift.io/managed: true") | not)
  2. Check the Remaining ones are not tags - select(.spec.tags[]?.from.kind != "ImageStreamTag" and (partial query here)
  • e.g. ImageStreamTag latest points to v1.2.3
  1. The ones that remain from that check to see if scheduled is false or not set - (.importPolicy.scheduled != null or .importPolicy.scheduled != false))] | any' %}}

If any fail the last condition it returns false for the query.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks a bunch for the breakdown and explanation of the jq filter.

@jan-cerny jan-cerny added the OpenShift OpenShift product related. label Jan 27, 2025
@prb112
Copy link
Contributor

prb112 commented Jan 27, 2025

/retest-required

Copy link

openshift-ci bot commented Jan 27, 2025

@prb112: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest-required

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.

@prb112
Copy link
Contributor

prb112 commented Feb 13, 2025

/jira-refresh

@yuumasato yuumasato self-assigned this Feb 28, 2025
@yuumasato
Copy link
Member

/ok-to-test

@openshift-ci openshift-ci bot added ok-to-test Used by openshift-ci bot. and removed needs-ok-to-test Used by openshift-ci bot. labels Feb 28, 2025
Copy link
Member

@yuumasato yuumasato left a comment

Choose a reason for hiding this comment

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

/LGTM

But could you also update the expected results so that our CI doesn't flag this change?

Change the following lines from FAIL to PASS.

$ grep -rA2 "imagestream-sets-schedule" tests/assertions/ocp4/
tests/assertions/ocp4/ocp4-stig-4.12.yml:  e2e-stig-imagestream-sets-schedule:
tests/assertions/ocp4/ocp4-stig-4.12.yml-    default_result: FAIL
tests/assertions/ocp4/ocp4-stig-4.12.yml-    result_after_remediation: FAIL
--
tests/assertions/ocp4/ocp4-stig-4.13.yml:  e2e-stig-imagestream-sets-schedule:
tests/assertions/ocp4/ocp4-stig-4.13.yml-    default_result: FAIL
tests/assertions/ocp4/ocp4-stig-4.13.yml-    result_after_remediation: FAIL
--
tests/assertions/ocp4/ocp4-stig-4.14.yml:  e2e-stig-imagestream-sets-schedule:
tests/assertions/ocp4/ocp4-stig-4.14.yml-    default_result: FAIL
tests/assertions/ocp4/ocp4-stig-4.14.yml-    result_after_remediation: FAIL
--
tests/assertions/ocp4/ocp4-stig-4.15.yml:  e2e-stig-imagestream-sets-schedule:
tests/assertions/ocp4/ocp4-stig-4.15.yml-    default_result: FAIL
tests/assertions/ocp4/ocp4-stig-4.15.yml-    result_after_remediation: FAIL
--
tests/assertions/ocp4/ocp4-stig-4.16.yml:  e2e-stig-imagestream-sets-schedule:
tests/assertions/ocp4/ocp4-stig-4.16.yml-    default_result: FAIL
tests/assertions/ocp4/ocp4-stig-4.16.yml-    result_after_remediation: FAIL
--
tests/assertions/ocp4/ocp4-stig-4.17.yml:  e2e-stig-imagestream-sets-schedule:
tests/assertions/ocp4/ocp4-stig-4.17.yml-    default_result: FAIL
tests/assertions/ocp4/ocp4-stig-4.17.yml-    result_after_remediation: FAIL
--
tests/assertions/ocp4/ocp4-stig-4.18.yml:  e2e-stig-imagestream-sets-schedule:
tests/assertions/ocp4/ocp4-stig-4.18.yml-    default_result: FAIL
tests/assertions/ocp4/ocp4-stig-4.18.yml-    result_after_remediation: FAIL
$ cat ./applications/openshift/registry/imagestream_sets_schedule/tests/ocp4/e2e.yml 
---
default_result: FAIL

@prb112
Copy link
Contributor

prb112 commented Feb 28, 2025

Thanks @yuumasato I'll leave a message with Kaushik letting him know

Signed-off-by: Kaushik Talathi <kaushik.talathi1@ibm.com>
Copy link
Member

@yuumasato yuumasato left a comment

Choose a reason for hiding this comment

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

@KaushikOP tests/assertions/ocp4/ocp4-stig-4.18.yml was left out of the assertion update.

Please update it as well.

@yuumasato
Copy link
Member

/test 4.17-e2e-aws-ocp4-stig
/test 4.18-e2e-aws-ocp4-stig

Signed-off-by: Kaushik Talathi <kaushik.talathi1@ibm.com>
@prb112
Copy link
Contributor

prb112 commented Mar 4, 2025

/retest-required

@KaushikOP KaushikOP requested a review from yuumasato March 5, 2025 07:08
@KaushikOP
Copy link
Author

Hi @yuumasato

I have made the changes. Please re-review.

@yuumasato yuumasato added this to the 0.1.77 milestone Mar 5, 2025
@rhmdnd
Copy link
Collaborator

rhmdnd commented Mar 5, 2025

/retest-required

@yuumasato
Copy link
Member

/test 4.12-e2e-aws-ocp4-stig
/test 4.16-e2e-aws-ocp4-stig

@prb112
Copy link
Contributor

prb112 commented Mar 5, 2025

Grabbed the imagestreams from the must-gather. https://gist.github.com/prb112/06768521d08ecf0eba49476252580e8e

Will ask @KaushikOP to test the jq locally to see why it failed.

@prb112
Copy link
Contributor

prb112 commented Mar 6, 2025

Analyzed the gist / imagestreams - it should have passed. Perhaps a retest?

@prb112
Copy link
Contributor

prb112 commented Mar 6, 2025

/retest-required

1 similar comment
@prb112
Copy link
Contributor

prb112 commented Mar 12, 2025

/retest-required

Copy link

openshift-ci bot commented Mar 12, 2025

@KaushikOP: 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/4.17-e2e-aws-ocp4-stig e594653 link true /test 4.17-e2e-aws-ocp4-stig
ci/prow/4.18-e2e-aws-ocp4-stig e594653 link true /test 4.18-e2e-aws-ocp4-stig
ci/prow/4.12-e2e-aws-ocp4-stig ec65613 link true /test 4.12-e2e-aws-ocp4-stig
ci/prow/4.16-e2e-aws-ocp4-stig ec65613 link true /test 4.16-e2e-aws-ocp4-stig

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ok-to-test Used by openshift-ci bot. OpenShift OpenShift product related.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants