From bda8c76724cf4b9ae0e38f6ea855950bce31221d Mon Sep 17 00:00:00 2001 From: Catarina Paralta <46568597+paralta@users.noreply.github.com> Date: Wed, 9 Aug 2023 16:12:43 +0100 Subject: [PATCH] fix: scan timeout not working (#542) --- pkg/orchestrator/scanconfigwatcher/helpers.go | 1 + pkg/orchestrator/scanwatcher/watcher.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/orchestrator/scanconfigwatcher/helpers.go b/pkg/orchestrator/scanconfigwatcher/helpers.go index b56875267..0a9b2b8c6 100644 --- a/pkg/orchestrator/scanconfigwatcher/helpers.go +++ b/pkg/orchestrator/scanconfigwatcher/helpers.go @@ -32,6 +32,7 @@ func newScanFromScanConfig(scanConfig *models.ScanConfig) *models.Scan { AssetScanTemplate: scanConfig.ScanTemplate.AssetScanTemplate, Scope: scanConfig.ScanTemplate.Scope, MaxParallelScanners: scanConfig.ScanTemplate.MaxParallelScanners, + TimeoutSeconds: scanConfig.ScanTemplate.TimeoutSeconds, State: utils.PointerTo(models.ScanStatePending), Summary: &models.ScanSummary{ JobsCompleted: utils.PointerTo(0), diff --git a/pkg/orchestrator/scanwatcher/watcher.go b/pkg/orchestrator/scanwatcher/watcher.go index 5ebe8999b..b77073398 100644 --- a/pkg/orchestrator/scanwatcher/watcher.go +++ b/pkg/orchestrator/scanwatcher/watcher.go @@ -132,7 +132,7 @@ func (w *Watcher) Reconcile(ctx context.Context, event ScanReconcileEvent) error } if scan.IsTimedOut(w.scanTimeout) { - scan.State = utils.PointerTo(models.ScanStateAborted) + scan.State = utils.PointerTo(models.ScanStateFailed) scan.StateMessage = utils.PointerTo("Scan has been timed out") scan.StateReason = utils.PointerTo(models.ScanStateReasonTimedOut)