@@ -102,15 +102,8 @@ func (impl *CdStage) handleCDEvent(ciCdRequest *helper.CiCdTriggerEvent) (bool,
102102 // specifically for isolated environment type, for IsVirtualExecution we don't send success event.
103103 // but failure event is sent in case of error.
104104 if err == nil && ! ciCdRequest .CommonWorkflowRequest .IsVirtualExecution {
105- log .Println (util .DEVTRON , " event" )
106- event := adaptor .NewCdCompleteEvent (ciCdRequest .CommonWorkflowRequest , true ).
107- WithPluginArtifacts (allPluginArtifacts ).
108- WithIsArtifactUploaded (artifactUploaded )
109- err = helper .SendCDEvent (ciCdRequest .CommonWorkflowRequest , event )
110- if err != nil {
111- log .Println (err )
112- }
113- log .Println (util .DEVTRON , " /event" )
105+ //send cd success event
106+ sendCDSuccessEvent (ciCdRequest .CommonWorkflowRequest , allPluginArtifacts , artifactUploaded )
114107 }
115108 return artifactUploaded , err
116109}
@@ -248,3 +241,15 @@ func sendCDFailureEvent(ciRequest *helper.CommonWorkflowRequest, err *helper.CdS
248241 log .Println (e )
249242 }
250243}
244+
245+ func sendCDSuccessEvent (commonWorkflowRequest * helper.CommonWorkflowRequest , allPluginArtifacts * helper.PluginArtifacts , artifactUploaded bool ) {
246+ log .Println (util .DEVTRON , " event" )
247+ event := adaptor .NewCdCompleteEvent (commonWorkflowRequest , true ).
248+ WithPluginArtifacts (allPluginArtifacts ).
249+ WithIsArtifactUploaded (artifactUploaded )
250+ err := helper .SendCDEvent (commonWorkflowRequest , event )
251+ if err != nil {
252+ log .Println (err )
253+ }
254+ log .Println (util .DEVTRON , " /event" )
255+ }
0 commit comments