Skip to content

CMP-3156: Simplify similar cases in ComplianceScan pending phase #693

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

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

Conversation

rhmdnd
Copy link

@rhmdnd rhmdnd commented Feb 26, 2025

We need to remove annotations when rerunning a scan, regardless of it
being rerun for a timeout or a rescan. We handled these cases
separately, but didn't need to since we're using delete(), which
performs a no-op if the annotation doesn't exist.

This PR simplifies the code by reducing both conditionals into a single
case.

@openshift-ci openshift-ci bot requested review from jhrozek and xiaojiey February 26, 2025 18:15
@rhmdnd rhmdnd changed the title CMP 3156 CMP-3156: Simplify similar cases in ComplianceScan pending phase Feb 26, 2025
@openshift-ci-robot
Copy link
Collaborator

@rhmdnd: This pull request references CMP-3156 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 sub-task to target the "4.19.0" version, but no target version was set.

In response to this:

  • Fix an issue in the ComplianceScan controller
  • Add a unit test for scan aggregating phase
  • CMP-3156: Simplify similar cases in ComplianceScan pending phase

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.

@@ -285,7 +285,7 @@ func (r *ReconcileComplianceScan) validate(instance *compv1alpha1.ComplianceScan
func (r *ReconcileComplianceScan) phasePendingHandler(instance *compv1alpha1.ComplianceScan, logger logr.Logger) (reconcile.Result, error) {
logger.Info("Phase: Pending")
// Remove annotation if needed
if instance.NeedsRescan() {
if instance.NeedsRescan() || instance.NeedsTimeoutRescan() {
Copy link
Author

Choose a reason for hiding this comment

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

Copy link

🤖 To deploy this PR, run the following command:

make catalog-deploy CATALOG_IMG=ghcr.io/complianceascode/compliance-operator-catalog:693-32bfffce6dcd1e449f192e523787d8f061e57fd2

Copy link

🤖 To deploy this PR, run the following command:

make catalog-deploy CATALOG_IMG=ghcr.io/complianceascode/compliance-operator-catalog:693-adae3f13c0a3d60f79e6394d25385aa2a1b9818b

Copy link

🤖 To deploy this PR, run the following command:

make catalog-deploy CATALOG_IMG=ghcr.io/complianceascode/compliance-operator-catalog:693-96119450fe5f52f3e3eb2f209b8212019d939870

@rhmdnd
Copy link
Author

rhmdnd commented Feb 26, 2025

/jira refresh

@openshift-ci-robot
Copy link
Collaborator

@rhmdnd: This pull request references CMP-3156 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 sub-task to target the "4.19.0" version, but no target version was set.

In response to this:

/jira refresh

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.

Copy link

🤖 To deploy this PR, run the following command:

make catalog-deploy CATALOG_IMG=ghcr.io/complianceascode/compliance-operator-catalog:693-d26d2c373a1eb795cf3f383d25e698c4a38d0042

@Vincent056
Copy link

/lgtm

Copy link

openshift-ci bot commented Feb 26, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rhmdnd, Vincent056

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

@rhmdnd
Copy link
Author

rhmdnd commented Feb 26, 2025

/test e2e-aws-serial

@rhmdnd
Copy link
Author

rhmdnd commented Feb 27, 2025

/jira refresh

@openshift-ci-robot
Copy link
Collaborator

@rhmdnd: This pull request references CMP-3156 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 sub-task to target the "4.19.0" version, but no target version was set.

In response to this:

/jira refresh

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.

We need to remove annotations when rerunning a scan, regardless of it
being rerun for a timeout or a rescan. We handled these cases
separately, but didn't need to since we're using `delete()`, which
performs a no-op if the annotation doesn't exist.

This PR simplifies the code by reducing both conditionals into a single
case.
@openshift-ci openshift-ci bot removed the lgtm label Feb 27, 2025
Copy link

openshift-ci bot commented Feb 27, 2025

New changes are detected. LGTM label has been removed.

@rhmdnd rhmdnd added this to the 1.7.0 milestone Feb 27, 2025
Copy link

🤖 To deploy this PR, run the following command:

make catalog-deploy CATALOG_IMG=ghcr.io/complianceascode/compliance-operator-catalog:693-916865c9dfd23e8c876abd378d688999f670315f

@rhmdnd
Copy link
Author

rhmdnd commented Feb 28, 2025

Seeing the following crop up in tests:

/go/src/github.com/openshift/compliance-operator/cmd/manager/resultcollector_test.go:45

@rhmdnd
Copy link
Author

rhmdnd commented Feb 28, 2025

/retest-required

@rhmdnd
Copy link
Author

rhmdnd commented Feb 28, 2025

Applying additional labels since this is only removing duplicate code

@rhmdnd rhmdnd removed this from the 1.7.0 milestone Apr 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants