@@ -573,15 +573,11 @@ func (impl *WorkflowDagExecutorImpl) HandlePreStageSuccessEvent(triggerContext t
573
573
scanEnabled , scanned := ciArtifact .ScanEnabled , ciArtifact .Scanned
574
574
isScanPluginConfigured , isScanningDoneViaPlugin , err := impl .isArtifactScannedByPluginForPipeline (ciArtifact , cdStageCompleteEvent .CdPipelineId , repository4 .PIPELINE_STAGE_TYPE_PRE_CD , bean2 .ImageScanningPluginToCheckInPipelineStageStep )
575
575
if err != nil {
576
- impl .logger .Errorw ("error in handling scanning event for ci artifact " , "ciArtifact" , ciArtifact , "err" , err )
576
+ impl .logger .Errorw ("error in checking if artifact scanned by plugin for a pipeline or not " , "ciArtifact" , ciArtifact , "err" , err )
577
577
return err
578
578
}
579
- if isScanPluginConfigured {
580
- ciArtifact .ScanEnabled = true
581
- }
582
- if isScanningDoneViaPlugin {
583
- ciArtifact .Scanned = true
584
- }
579
+ helper .UpdateScanStatusInCiArtifact (ciArtifact , isScanPluginConfigured , isScanningDoneViaPlugin )
580
+
585
581
// if ciArtifact scanEnabled and scanned state changed from above func then update ciArtifact
586
582
if scanEnabled != ciArtifact .ScanEnabled || scanned != ciArtifact .Scanned {
587
583
err = impl .ciArtifactRepository .Update (ciArtifact )
@@ -686,15 +682,11 @@ func (impl *WorkflowDagExecutorImpl) HandlePostStageSuccessEvent(triggerContext
686
682
scanEnabled , scanned := ciArtifact .ScanEnabled , ciArtifact .Scanned
687
683
isScanPluginConfigured , isScanningDoneViaPlugin , err := impl .isArtifactScannedByPluginForPipeline (ciArtifact , cdPipelineId , repository4 .PIPELINE_STAGE_TYPE_POST_CD , bean2 .ImageScanningPluginToCheckInPipelineStageStep )
688
684
if err != nil {
689
- impl .logger .Errorw ("error in handling scanning event for ci artifact " , "ciArtifact" , ciArtifact , "err" , err )
685
+ impl .logger .Errorw ("error in checking if artifact scanned by plugin for a pipeline or not " , "ciArtifact" , ciArtifact , "err" , err )
690
686
return err
691
687
}
692
- if isScanPluginConfigured {
693
- ciArtifact .ScanEnabled = true
694
- }
695
- if isScanningDoneViaPlugin {
696
- ciArtifact .Scanned = true
697
- }
688
+ helper .UpdateScanStatusInCiArtifact (ciArtifact , isScanPluginConfigured , isScanningDoneViaPlugin )
689
+
698
690
// if ciArtifact scanEnabled and scanned state changed from above func then update ciArtifact
699
691
if scanEnabled != ciArtifact .ScanEnabled || scanned != ciArtifact .Scanned {
700
692
err = impl .ciArtifactRepository .Update (ciArtifact )
@@ -814,15 +806,10 @@ func (impl *WorkflowDagExecutorImpl) HandleCiSuccessEvent(triggerContext trigger
814
806
} else {
815
807
isScanPluginConfigured , isScanningDoneViaPlugin , err := impl .isArtifactScannedByPluginForPipeline (buildArtifact , pipelineModal .Id , pipelineStage , bean2 .ImageScanningPluginToCheckInPipelineStageStep )
816
808
if err != nil {
817
- impl .logger .Errorw ("error in handling scanning event for this ci artifact " , "ciArtifact" , buildArtifact , "err" , err )
809
+ impl .logger .Errorw ("error in checking if artifact scanned by plugin for a pipeline or not " , "ciArtifact" , buildArtifact , "err" , err )
818
810
return 0 , err
819
811
}
820
- if isScanPluginConfigured {
821
- buildArtifact .ScanEnabled = true
822
- }
823
- if isScanningDoneViaPlugin {
824
- buildArtifact .Scanned = true
825
- }
812
+ helper .UpdateScanStatusInCiArtifact (buildArtifact , isScanPluginConfigured , isScanningDoneViaPlugin )
826
813
}
827
814
828
815
if err = impl .ciArtifactRepository .Save (buildArtifact ); err != nil {
0 commit comments