File tree Expand file tree Collapse file tree
controllers/execution/scans Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -170,7 +170,7 @@ const (
170170type ScanStatus struct {
171171 State ScanState `json:"state,omitempty"`
172172
173- // FinishedAt contains the time where the scan (including parser & hooks) has been marked as "Done"
173+ // FinishedAt contains the time where the scan (including parser & hooks) has been marked as "Done", or has errored
174174 FinishedAt * metav1.Time `json:"finishedAt,omitempty"`
175175 ErrorDescription string `json:"errorDescription,omitempty"`
176176
Original file line number Diff line number Diff line change @@ -256,10 +256,12 @@ func updateScanStateMetrics(scan executionv1.Scan) {
256256
257257func (r * ScanReconciler ) updateScanStatus (ctx context.Context , scan * executionv1.Scan ) error {
258258 updateScanStateMetrics (* scan )
259-
260- if scan .Status .FinishedAt == nil {
261- scan .Status .FinishedAt = & metav1.Time {Time : time .Now ()}
259+ if scan .Status .State == executionv1 .ScanStateDone || scan .Status .State == executionv1 .ScanStateErrored {
260+ if scan .Status .FinishedAt == nil {
261+ scan .Status .FinishedAt = & metav1.Time {Time : time .Now ()}
262+ }
262263 }
264+
263265 if err := r .Status ().Update (ctx , scan ); err != nil {
264266 r .Log .Error (err , "unable to update Scan status" )
265267 return err
You can’t perform that action at this time.
0 commit comments