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

OCPBUGS-31510: change the analysis to not include ImageStreamTag #11769

Closed
wants to merge 1 commit into from

Conversation

prb112
Copy link
Contributor

@prb112 prb112 commented Mar 28, 2024

Description:

ImageStreamTag is improperly considered with the rule.yaml

Rationale:

https://issues.redhat.com/browse/OCPBUGS-31510

Review Hints:

The logic changes are for rhcos4-disa-stig.

@openshift-ci openshift-ci bot added the needs-ok-to-test Used by openshift-ci bot. label Mar 28, 2024
Copy link

openshift-ci bot commented Mar 28, 2024

Hi @prb112. 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/test-infra repository.

Copy link

github-actions bot commented Mar 28, 2024

Start a new ephemeral environment with changes proposed in this pull request:

ocp4 (from CTF) Environment (using Fedora as testing environment)
Open in Gitpod

Fedora Testing Environment
Open in Gitpod

Oracle Linux 8 Environment
Open in Gitpod

Copy link

github-actions bot commented Mar 28, 2024

🤖 A k8s content image for this PR is available at:
ghcr.io/complianceascode/k8scontent:11769
This image was built from commit: 735c29d

Click here to see how to deploy it

If you alread have Compliance Operator deployed:
utils/build_ds_container.py -i ghcr.io/complianceascode/k8scontent:11769

Otherwise deploy the content and operator together by checking out ComplianceAsCode/compliance-operator and:
CONTENT_IMAGE=ghcr.io/complianceascode/k8scontent:11769 make deploy-local

@@ -58,6 +58,6 @@ template:
check_existence: "all_exist"
entity_check: "all"
values:
- value: "true"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the logic was previously incorrect.

@prb112 prb112 force-pushed the OCPBUGS-31510 branch 4 times, most recently from 8cade16 to 1b0fa34 Compare April 1, 2024 18:05
Signed-off-by: Paul Bastide <pbastide@us.ibm.com>
Copy link

github-actions bot commented Apr 1, 2024

This datastream diff is auto generated by the check Compare DS/Generate Diff

Click here to see the full diff
New content has different text for rule 'xccdf_org.ssgproject.content_rule_imagestream_sets_schedule'.
--- xccdf_org.ssgproject.content_rule_imagestream_sets_schedule
+++ xccdf_org.ssgproject.content_rule_imagestream_sets_schedule
@@ -22,9 +22,9 @@
 Therefore, you need to use a tool that can query the OCP API, retrieve the following:
 /apis/image.openshift.io/v1/imagestreams
     API endpoint, filter with with the jq utility using the following filter
-    [.items[]] | map(.spec.tags[]?.importPolicy.scheduled != true) | any
+    [.items[]] | map(.spec.tags[]? | select(.from.kind != "ImageStreamTag").importPolicy.scheduled != true) | all
     and persist it to the local
-    /apis/image.openshift.io/v1/imagestreams#47d97a900e89c07d2fcec9092f067d294f3d90e7c02e37b073c60576a6fa602f
+    /apis/image.openshift.io/v1/imagestreams#85b4d8321bba63986c7e3bbe690759a9faa62a6ae957fc834852b13cc854cd53
     file.
 
 [reference]:

OCIL for rule 'xccdf_org.ssgproject.content_rule_imagestream_sets_schedule' differs.
--- ocil:ssg-imagestream_sets_schedule_ocil:questionnaire:1
+++ ocil:ssg-imagestream_sets_schedule_ocil:questionnaire:1
@@ -1,8 +1,8 @@
 To list all the imagestreams and identify which imagestream tags are
 configured to periodically check for updates (imagePolicy = { scheduled: true }), run the following command:
-oc get imagestream  --all-namespaces -o jsonpath='[.items[]] | map(.spec.tags[]?.importPolicy.scheduled != true) | any'
+oc get imagestream  --all-namespaces -o jsonpath='[.items[]] | map(.spec.tags[]? | select(.from.kind != "ImageStreamTag").importPolicy.scheduled != true) | all'
 Alternatively, to view a list of ImageStreams that do not schedule updates,
 run:
-oc get imagestreams -A -ojson | jq '.items[] | select(.spec.tags[]?.importPolicy.scheduled != true) | .metadata.name' | sort | uniq
+oc get imagestreams -A -ojson | jq -r '.items[] | select(.spec.tags[]? | .from.kind == "DockerImage" and .importPolicy.scheduled != true) | .metadata.name' | sort | uniq
       Is it the case that imagestream is not configured to perform periodical updates?
       

Copy link

codeclimate bot commented Apr 1, 2024

Code Climate has analyzed commit 735c29d and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (50% is the threshold).

This pull request will bring the total coverage in the repository to 59.3% (0.0% change).

View more on Code Climate.

@prb112 prb112 closed this Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-ok-to-test Used by openshift-ci bot.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant