Skip to content
This repository was archived by the owner on Oct 14, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion operator/apis/execution/v1/scan_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ type ScanSpec struct {
type ScanStatus struct {
State string `json:"state,omitempty"`

ErrorDescription string `json:"errorDescription,omitempty"`
// FinishedAt contains the time where the scan (including parser & hooks) has been marked as "Done"
FinishedAt *metav1.Time `json:"finishedAt,omitempty"`
ErrorDescription string `json:"errorDescription,omitempty"`

// RawResultType determines which kind of ParseDefinition will be used to turn the raw results of the scanner into findings
RawResultType string `json:"rawResultType,omitempty"`
Expand Down
4 changes: 4 additions & 0 deletions operator/apis/execution/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,11 @@ spec:
type: integer
type: object
type: object
finishedAt:
description: FinishedAt contains the time where the scan (including
parser & hooks) has been marked as "Done"
format: date-time
type: string
rawResultFile:
description: RawResultFile Filename of the result file of the scanner.
e.g. `nmap-result.xml`
Expand Down
4 changes: 4 additions & 0 deletions operator/controllers/execution/scans/hook_reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,8 @@ func (r *ScanReconciler) startReadOnlyHooks(scan *executionv1.Scan) error {
if len(readOnlyHooks) == 0 {
r.Log.Info("Marked scan as done as without running ReadOnly hooks as non were configured", "ScanName", scan.Name)
scan.Status.State = "Done"
var now metav1.Time = metav1.Now()
scan.Status.FinishedAt = &now
if err := r.Status().Update(ctx, scan); err != nil {
r.Log.Error(err, "Unable to update Scan status")
return err
Expand Down Expand Up @@ -281,6 +283,8 @@ func (r *ScanReconciler) checkIfReadOnlyHookIsCompleted(scan *executionv1.Scan)
if readOnlyHookCompletion == completed {
r.Log.V(7).Info("All ReadOnlyHooks have completed")
scan.Status.State = "Done"
var now metav1.Time = metav1.Now()
scan.Status.FinishedAt = &now
if err := r.Status().Update(ctx, scan); err != nil {
r.Log.Error(err, "Unable to update Scan status")
return err
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,11 @@ spec:
type: integer
type: object
type: object
finishedAt:
description: FinishedAt contains the time where the scan (including
parser & hooks) has been marked as "Done"
format: date-time
type: string
rawResultFile:
description: RawResultFile Filename of the result file of the scanner.
e.g. `nmap-result.xml`
Expand Down