@@ -572,21 +572,29 @@ func (impl *WorkflowDagExecutorImpl) buildWFRequest(runner *pipelineConfig.CdWor
572
572
var stageYaml string
573
573
var deployStageWfr pipelineConfig.CdWorkflowRunner
574
574
deployStageTriggeredByUser := & bean.UserInfo {}
575
+ var pipelineReleaseCounter int
575
576
if runner .WorkflowType == bean .CD_WORKFLOW_TYPE_PRE {
576
577
stageYaml = cdPipeline .PreStageConfig
577
578
} else if runner .WorkflowType == bean .CD_WORKFLOW_TYPE_POST {
578
579
stageYaml = cdPipeline .PostStageConfig
579
580
//getting deployment pipeline latest wfr by pipelineId
580
- deployStageWfr , err = impl .cdWorkflowRepository .FindLastStatusByPipelineIdAndRunnerType (cdPipeline .Id , bean .CD_WORKFLOW_TYPE_DEPLOY )
581
+ pipelineId := cdPipeline .Id
582
+ deployStageWfr , err = impl .cdWorkflowRepository .FindLastStatusByPipelineIdAndRunnerType (pipelineId , bean .CD_WORKFLOW_TYPE_DEPLOY )
581
583
if err != nil {
582
- impl .logger .Errorw ("error in getting latest status of deploy type wfr by pipelineId" , "err" , err , "pipelineId" , cdPipeline . Id )
584
+ impl .logger .Errorw ("error in getting latest status of deploy type wfr by pipelineId" , "err" , err , "pipelineId" , pipelineId )
583
585
return nil , err
584
586
}
585
587
deployStageTriggeredByUser , err = impl .user .GetById (deployStageWfr .TriggeredBy )
586
588
if err != nil {
587
589
impl .logger .Errorw ("error in getting userDetails by id" , "err" , err , "userId" , deployStageWfr .TriggeredBy )
588
590
return nil , err
589
591
}
592
+ pipelineReleaseCounter , err = impl .pipelineOverrideRepository .GetCurrentPipelineReleaseCounter (pipelineId )
593
+ if err != nil {
594
+ impl .logger .Errorw ("error occurred while fetching latest release counter for pipeline" , "pipelineId" , pipelineId , "err" , err )
595
+ return nil , err
596
+ }
597
+
590
598
} else {
591
599
return nil , fmt .Errorf ("unsupported workflow triggerd" )
592
600
}
@@ -632,6 +640,9 @@ func (impl *WorkflowDagExecutorImpl) buildWFRequest(runner *pipelineConfig.CdWor
632
640
cdStageWorkflowRequest .DeploymentTriggerTime = deployStageWfr .StartedOn
633
641
cdStageWorkflowRequest .DeploymentTriggeredBy = deployStageTriggeredByUser .EmailId
634
642
}
643
+ if pipelineReleaseCounter > 0 {
644
+ cdStageWorkflowRequest .DeploymentReleaseCounter = pipelineReleaseCounter
645
+ }
635
646
if cdWorkflowConfig .CdCacheRegion == "" {
636
647
cdWorkflowConfig .CdCacheRegion = impl .cdConfig .DefaultCdLogsBucketRegion
637
648
}
0 commit comments