@@ -23,7 +23,7 @@ import (
2323 "github.com/argoproj/argo-workflows/v3/pkg/apis/workflow/v1alpha1"
2424 blob_storage "github.com/devtron-labs/common-lib/blob-storage"
2525 commonBean "github.com/devtron-labs/common-lib/workflow"
26- bean2 "github.com/devtron-labs/devtron/api/bean"
26+ apiBean "github.com/devtron-labs/devtron/api/bean"
2727 gitSensorClient "github.com/devtron-labs/devtron/client/gitSensor"
2828 constants2 "github.com/devtron-labs/devtron/internal/sql/constants"
2929 "github.com/devtron-labs/devtron/internal/sql/repository"
@@ -62,7 +62,7 @@ import (
6262)
6363
6464func (impl * HandlerServiceImpl ) TriggerPreStage (request bean.TriggerRequest ) (* bean6.ManifestPushTemplate , error ) {
65- request .WorkflowType = bean2 .CD_WORKFLOW_TYPE_PRE
65+ request .WorkflowType = apiBean .CD_WORKFLOW_TYPE_PRE
6666 // setting triggeredAt variable to have consistent data for various audit log places in db for deployment time
6767 triggeredAt := time .Now ()
6868 triggeredBy := request .TriggeredBy
@@ -219,7 +219,7 @@ func (impl *HandlerServiceImpl) TriggerAutoCDOnPreStageSuccess(triggerContext be
219219func (impl * HandlerServiceImpl ) checkDeploymentTriggeredAlready (wfId int ) bool {
220220 deploymentTriggeredAlready := false
221221 // TODO : need to check this logic for status check in case of multiple deployments requirement for same workflow
222- workflowRunner , err := impl .cdWorkflowRepository .FindByWorkflowIdAndRunnerType (context .Background (), wfId , bean2 .CD_WORKFLOW_TYPE_DEPLOY )
222+ workflowRunner , err := impl .cdWorkflowRepository .FindByWorkflowIdAndRunnerType (context .Background (), wfId , apiBean .CD_WORKFLOW_TYPE_DEPLOY )
223223 if err != nil {
224224 impl .logger .Errorw ("error occurred while fetching workflow runner" , "wfId" , wfId , "err" , err )
225225 return deploymentTriggeredAlready
@@ -236,7 +236,7 @@ func (impl *HandlerServiceImpl) createStartingWfAndRunner(request bean.TriggerRe
236236 //in case of pre stage manual trigger auth is already applied and for auto triggers there is no need for auth check here
237237 cdWf := request .CdWf
238238 var err error
239- if cdWf == nil && request .WorkflowType == bean2 .CD_WORKFLOW_TYPE_PRE {
239+ if cdWf == nil && request .WorkflowType == apiBean .CD_WORKFLOW_TYPE_PRE {
240240 cdWf = & pipelineConfig.CdWorkflow {
241241 CiArtifactId : artifact .Id ,
242242 PipelineId : pipeline .Id ,
@@ -279,9 +279,9 @@ func (impl *HandlerServiceImpl) getEnvAndNsIfRunStageInEnv(ctx context.Context,
279279 var err error
280280 namespace := impl .config .GetDefaultNamespace ()
281281 runStageInEnv := false
282- if workflowStage == bean2 .CD_WORKFLOW_TYPE_PRE {
282+ if workflowStage == apiBean .CD_WORKFLOW_TYPE_PRE {
283283 runStageInEnv = pipeline .RunPreStageInEnv
284- } else if workflowStage == bean2 .CD_WORKFLOW_TYPE_POST {
284+ } else if workflowStage == apiBean .CD_WORKFLOW_TYPE_POST {
285285 runStageInEnv = pipeline .RunPostStageInEnv
286286 }
287287 _ , span := otel .Tracer ("orchestrator" ).Start (ctx , "envRepository.FindById" )
@@ -588,7 +588,7 @@ func (impl *HandlerServiceImpl) buildWFRequest(runner *pipelineConfig.CdWorkflow
588588 }
589589 if pipelineStage != nil {
590590 var variableSnapshot map [string ]string
591- if runner .WorkflowType == bean2 .CD_WORKFLOW_TYPE_PRE {
591+ if runner .WorkflowType == apiBean .CD_WORKFLOW_TYPE_PRE {
592592 // TODO: use const from pipeline.WorkflowService:95
593593 request := pipelineConfigBean .NewBuildPrePostStepDataReq (cdPipeline .Id , "preCD" , scope )
594594 prePostAndRefPluginResponse , err := impl .pipelineStageService .BuildPrePostAndRefPluginStepsDataForWfRequest (request )
@@ -599,7 +599,7 @@ func (impl *HandlerServiceImpl) buildWFRequest(runner *pipelineConfig.CdWorkflow
599599 preDeploySteps = prePostAndRefPluginResponse .PreStageSteps
600600 refPluginsData = prePostAndRefPluginResponse .RefPluginData
601601 variableSnapshot = prePostAndRefPluginResponse .VariableSnapshot
602- } else if runner .WorkflowType == bean2 .CD_WORKFLOW_TYPE_POST {
602+ } else if runner .WorkflowType == apiBean .CD_WORKFLOW_TYPE_POST {
603603 // TODO: use const from pipeline.WorkflowService:96
604604 request := pipelineConfigBean .NewBuildPrePostStepDataReq (cdPipeline .Id , "postCD" , scope )
605605 prePostAndRefPluginResponse , err := impl .pipelineStageService .BuildPrePostAndRefPluginStepsDataForWfRequest (request )
@@ -630,9 +630,9 @@ func (impl *HandlerServiceImpl) buildWFRequest(runner *pipelineConfig.CdWorkflow
630630 }
631631 } else {
632632 //in this case no plugin script is not present for this cdPipeline hence going with attaching preStage or postStage config
633- if runner .WorkflowType == bean2 .CD_WORKFLOW_TYPE_PRE {
633+ if runner .WorkflowType == apiBean .CD_WORKFLOW_TYPE_PRE {
634634 stageYaml = cdPipeline .PreStageConfig
635- } else if runner .WorkflowType == bean2 .CD_WORKFLOW_TYPE_POST {
635+ } else if runner .WorkflowType == apiBean .CD_WORKFLOW_TYPE_POST {
636636 stageYaml = cdPipeline .PostStageConfig
637637 deployStageWfr , deployStageTriggeredByUserEmail , pipelineReleaseCounter , err = impl .getDeployStageDetails (cdPipeline .Id )
638638 if err != nil {
@@ -813,11 +813,11 @@ func (impl *HandlerServiceImpl) buildWFRequest(runner *pipelineConfig.CdWorkflow
813813 // For Pre-CD / Post-CD workflow, cache is not uploaded; hence no need to set cache bucket
814814 cdWorkflowConfigCdCacheBucket := ""
815815
816- if runner .WorkflowType == bean2 .CD_WORKFLOW_TYPE_PRE {
816+ if runner .WorkflowType == apiBean .CD_WORKFLOW_TYPE_PRE {
817817 // populate input variables of steps with extra env variables
818818 setExtraEnvVariableInDeployStep (preDeploySteps , runtimeParams .GetSystemVariables (), webhookAndCiData )
819819 cdStageWorkflowRequest .PrePostDeploySteps = preDeploySteps
820- } else if runner .WorkflowType == bean2 .CD_WORKFLOW_TYPE_POST {
820+ } else if runner .WorkflowType == apiBean .CD_WORKFLOW_TYPE_POST {
821821 // populate input variables of steps with extra env variables
822822 setExtraEnvVariableInDeployStep (postDeploySteps , runtimeParams .GetSystemVariables (), webhookAndCiData )
823823 cdStageWorkflowRequest .PrePostDeploySteps = postDeploySteps
@@ -1007,7 +1007,7 @@ func setExtraEnvVariableInDeployStep(deploySteps []*pipelineConfigBean.StepObjec
10071007func (impl * HandlerServiceImpl ) getDeployStageDetails (pipelineId int ) (pipelineConfig.CdWorkflowRunner , string , int , error ) {
10081008 deployStageWfr := pipelineConfig.CdWorkflowRunner {}
10091009 //getting deployment pipeline latest wfr by pipelineId
1010- deployStageWfr , err := impl .cdWorkflowRepository .FindLatestByPipelineIdAndRunnerType (pipelineId , bean2 .CD_WORKFLOW_TYPE_DEPLOY )
1010+ deployStageWfr , err := impl .cdWorkflowRepository .FindLatestByPipelineIdAndRunnerType (pipelineId , apiBean .CD_WORKFLOW_TYPE_DEPLOY )
10111011 if err != nil {
10121012 impl .logger .Errorw ("error in getting latest status of deploy type wfr by pipelineId" , "err" , err , "pipelineId" , pipelineId )
10131013 return deployStageWfr , "" , 0 , err
@@ -1046,14 +1046,14 @@ func ReplaceImageTagWithDigest(image, digest string) string {
10461046}
10471047
10481048func (impl * HandlerServiceImpl ) sendPreStageNotification (ctx context.Context , cdWf * pipelineConfig.CdWorkflow , pipeline * pipelineConfig.Pipeline ) error {
1049- wfr , err := impl .cdWorkflowRepository .FindByWorkflowIdAndRunnerType (ctx , cdWf .Id , bean2 .CD_WORKFLOW_TYPE_PRE )
1049+ wfr , err := impl .cdWorkflowRepository .FindByWorkflowIdAndRunnerType (ctx , cdWf .Id , apiBean .CD_WORKFLOW_TYPE_PRE )
10501050 if err != nil {
10511051 return err
10521052 }
10531053
10541054 event , _ := impl .eventFactory .Build (util2 .Trigger , & pipeline .Id , pipeline .AppId , & pipeline .EnvironmentId , util2 .CD )
10551055 impl .logger .Debugw ("event PreStageTrigger" , "event" , event )
1056- event = impl .eventFactory .BuildExtraCDData (event , & wfr , 0 , bean2 .CD_WORKFLOW_TYPE_PRE )
1056+ event = impl .eventFactory .BuildExtraCDData (event , & wfr , 0 , apiBean .CD_WORKFLOW_TYPE_PRE )
10571057 _ , span := otel .Tracer ("orchestrator" ).Start (ctx , "eventClient.WriteNotificationEvent" )
10581058 _ , evtErr := impl .eventClient .WriteNotificationEvent (event )
10591059 span .End ()
0 commit comments