Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ComplianceAsCode/compliance-operator
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: b312849d1addb1a0a665f2df7fd02036e3d05956
Choose a base ref
..
head repository: ComplianceAsCode/compliance-operator
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 8aafdace03903b542063e36753af0ed8eeb98dd9
Choose a head ref
Showing with 13 additions and 1 deletion.
  1. +13 −1 pkg/controller/compliancescan/compliancescan_controller.go
14 changes: 13 additions & 1 deletion pkg/controller/compliancescan/compliancescan_controller.go
Original file line number Diff line number Diff line change
@@ -656,8 +656,20 @@ func (r *ReconcileComplianceScan) phaseAggregatingHandler(h scanTypeHandler, log
logger.Error(err, "Cannot fetch the number of checks")
return reconcile.Result{}, err
}

instanceCopy := instance.DeepCopy()

if instanceCopy.Annotations == nil {
instanceCopy.Annotations = make(map[string]string)
}

// adding check count annotation
instance.Annotations[compv1alpha1.ComplianceCheckCountAnnotation] = strconv.Itoa(checkCount)
instanceCopy.Annotations[compv1alpha1.ComplianceCheckCountAnnotation] = strconv.Itoa(checkCount)

if err := r.Client.Update(context.TODO(), instanceCopy); err != nil {
logger.Error(err, "Cannot update the scan with the check count")
return reconcile.Result{}, err
}
instance.Status.Phase = compv1alpha1.PhaseDone
instance.Status.EndTimestamp = &metav1.Time{Time: time.Now()}
instance.Status.SetConditionReady()