diff --git a/ci-runner/executor/stage/ciStages.go b/ci-runner/executor/stage/ciStages.go index d016f07b6..e120ce30a 100644 --- a/ci-runner/executor/stage/ciStages.go +++ b/ci-runner/executor/stage/ciStages.go @@ -257,7 +257,7 @@ func (impl *CiStage) runCIStages(ciContext cicxt.CiContext, ciCdRequest *helper. metrics.PostCiStartTime = start var pluginArtifacts *helper.PluginArtifacts if len(ciCdRequest.CommonWorkflowRequest.PostCiSteps) > 0 { - pluginArtifacts, err = impl.runPostCiSteps(ciCdRequest, scriptEnvs, refStageMap, preCiStageOutVariable, metrics, artifactUploaded, dest, digest) + pluginArtifacts, resultsFromPlugin, err = impl.runPostCiSteps(ciCdRequest, scriptEnvs, refStageMap, preCiStageOutVariable, metrics, artifactUploaded, dest, digest) postCiDuration = time.Since(start).Seconds() if err != nil { return artifactUploaded, err @@ -436,7 +436,7 @@ func (impl *CiStage) extractDigest(ciCdRequest *helper.CiCdTriggerEvent, dest st return digest, err } -func (impl *CiStage) runPostCiSteps(ciCdRequest *helper.CiCdTriggerEvent, scriptEnvs map[string]string, refStageMap map[int][]*helper.StepObject, preCiStageOutVariable map[int]map[string]*helper.VariableObject, metrics *helper.CIMetrics, artifactUploaded bool, dest string, digest string) (*helper.PluginArtifacts, error) { +func (impl *CiStage) runPostCiSteps(ciCdRequest *helper.CiCdTriggerEvent, scriptEnvs map[string]string, refStageMap map[int][]*helper.StepObject, preCiStageOutVariable map[int]map[string]*helper.VariableObject, metrics *helper.CIMetrics, artifactUploaded bool, dest string, digest string) (*helper.PluginArtifacts, json.RawMessage, error) { log.Println("running POST-CI steps") // sending build success as true always as post-ci triggers only if ci gets success scriptEnvs[util.ENV_VARIABLE_BUILD_SUCCESS] = "true" @@ -446,13 +446,20 @@ func (impl *CiStage) runPostCiSteps(ciCdRequest *helper.CiCdTriggerEvent, script pluginArtifactsFromFile, _, step, err := impl.stageExecutorManager.RunCiCdSteps(helper.STEP_TYPE_POST, ciCdRequest.CommonWorkflowRequest, ciCdRequest.CommonWorkflowRequest.PostCiSteps, refStageMap, scriptEnvs, preCiStageOutVariable) if err != nil { log.Println("error in running Post Ci Steps", "err", err) - return nil, helper.NewCiStageError(err). + return nil, nil, helper.NewCiStageError(err). WithMetrics(metrics). WithFailureMessage(fmt.Sprintf(workFlow.PostCiFailed.String(), step.Name)). WithArtifactUploaded(artifactUploaded) } //sent by orchestrator if copy container image v2 is configured - return pluginArtifactsFromFile, nil + + // considering pull images from Container repo Plugin in post ci steps also. + // making it non-blocking if results are not available (in case of err) + resultsFromPlugin, fileErr := extractOutResultsIfExists() + if fileErr != nil { + log.Println("error in getting results", "err", fileErr.Error()) + } + return pluginArtifactsFromFile, resultsFromPlugin, nil } func runImageScanning(dest string, digest string, ciCdRequest *helper.CiCdTriggerEvent, metrics *helper.CIMetrics, artifactUploaded bool) error {