@@ -315,6 +315,7 @@ func (r *ScanReconciler) startParser(scan *executionv1.Scan) error {
315315 }
316316 labels ["experimental.securecodebox.io/job-type" ] = "parser"
317317 automountServiceAccountToken := true
318+ var backOffLimit int32 = 3
318319 job = & batch.Job {
319320 ObjectMeta : metav1.ObjectMeta {
320321 Annotations : make (map [string ]string ),
@@ -323,6 +324,7 @@ func (r *ScanReconciler) startParser(scan *executionv1.Scan) error {
323324 Labels : labels ,
324325 },
325326 Spec : batch.JobSpec {
327+ BackoffLimit : & backOffLimit ,
326328 Template : corev1.PodTemplateSpec {
327329 Spec : corev1.PodSpec {
328330 RestartPolicy : corev1 .RestartPolicyNever ,
@@ -521,6 +523,7 @@ func (r *ScanReconciler) constructJobForScan(scan *executionv1.Scan, scanType *e
521523 {
522524 Name : "scan-results" ,
523525 MountPath : "/home/securecodebox/" ,
526+ ReadOnly : true ,
524527 },
525528 },
526529 }
@@ -556,7 +559,6 @@ func (r *ScanReconciler) PresignedGetURL(scanID types.UID, filename string) (str
556559 return rawResultDownloadURL .String (), nil
557560}
558561
559- // PresignedGetURL returns a presigned URL from the s3 (or compatible) serice.
560562func (r * ScanReconciler ) startPersistenceProvider (scan * executionv1.Scan ) error {
561563 ctx := context .Background ()
562564
@@ -670,20 +672,16 @@ func (r *ScanReconciler) startPersistenceProvider(scan *executionv1.Scan) error
670672}
671673
672674func allJobsCompleted (jobs * batch.JobList ) jobCompletionType {
673- hasFailed := false
674675 hasCompleted := true
675676
676677 for _ , job := range jobs .Items {
677678 if job .Status .Failed > 0 {
678- hasFailed = true
679+ return failed
679680 } else if job .Status .Succeeded == 0 {
680681 hasCompleted = false
681682 }
682683 }
683684
684- if hasFailed {
685- return failed
686- }
687685 if hasCompleted {
688686 return completed
689687 }
0 commit comments