@@ -23,7 +23,7 @@ import (
23
23
"github.com/argoproj/argo-workflows/v3/pkg/apis/workflow/v1alpha1"
24
24
blob_storage "github.com/devtron-labs/common-lib/blob-storage"
25
25
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"
27
27
gitSensorClient "github.com/devtron-labs/devtron/client/gitSensor"
28
28
constants2 "github.com/devtron-labs/devtron/internal/sql/constants"
29
29
"github.com/devtron-labs/devtron/internal/sql/repository"
@@ -62,7 +62,7 @@ import (
62
62
)
63
63
64
64
func (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
66
66
// setting triggeredAt variable to have consistent data for various audit log places in db for deployment time
67
67
triggeredAt := time .Now ()
68
68
triggeredBy := request .TriggeredBy
@@ -219,7 +219,7 @@ func (impl *HandlerServiceImpl) TriggerAutoCDOnPreStageSuccess(triggerContext be
219
219
func (impl * HandlerServiceImpl ) checkDeploymentTriggeredAlready (wfId int ) bool {
220
220
deploymentTriggeredAlready := false
221
221
// 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 )
223
223
if err != nil {
224
224
impl .logger .Errorw ("error occurred while fetching workflow runner" , "wfId" , wfId , "err" , err )
225
225
return deploymentTriggeredAlready
@@ -236,7 +236,7 @@ func (impl *HandlerServiceImpl) createStartingWfAndRunner(request bean.TriggerRe
236
236
//in case of pre stage manual trigger auth is already applied and for auto triggers there is no need for auth check here
237
237
cdWf := request .CdWf
238
238
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 {
240
240
cdWf = & pipelineConfig.CdWorkflow {
241
241
CiArtifactId : artifact .Id ,
242
242
PipelineId : pipeline .Id ,
@@ -279,9 +279,9 @@ func (impl *HandlerServiceImpl) getEnvAndNsIfRunStageInEnv(ctx context.Context,
279
279
var err error
280
280
namespace := impl .config .GetDefaultNamespace ()
281
281
runStageInEnv := false
282
- if workflowStage == bean2 .CD_WORKFLOW_TYPE_PRE {
282
+ if workflowStage == apiBean .CD_WORKFLOW_TYPE_PRE {
283
283
runStageInEnv = pipeline .RunPreStageInEnv
284
- } else if workflowStage == bean2 .CD_WORKFLOW_TYPE_POST {
284
+ } else if workflowStage == apiBean .CD_WORKFLOW_TYPE_POST {
285
285
runStageInEnv = pipeline .RunPostStageInEnv
286
286
}
287
287
_ , span := otel .Tracer ("orchestrator" ).Start (ctx , "envRepository.FindById" )
@@ -588,7 +588,7 @@ func (impl *HandlerServiceImpl) buildWFRequest(runner *pipelineConfig.CdWorkflow
588
588
}
589
589
if pipelineStage != nil {
590
590
var variableSnapshot map [string ]string
591
- if runner .WorkflowType == bean2 .CD_WORKFLOW_TYPE_PRE {
591
+ if runner .WorkflowType == apiBean .CD_WORKFLOW_TYPE_PRE {
592
592
// TODO: use const from pipeline.WorkflowService:95
593
593
request := pipelineConfigBean .NewBuildPrePostStepDataReq (cdPipeline .Id , "preCD" , scope )
594
594
prePostAndRefPluginResponse , err := impl .pipelineStageService .BuildPrePostAndRefPluginStepsDataForWfRequest (request )
@@ -599,7 +599,7 @@ func (impl *HandlerServiceImpl) buildWFRequest(runner *pipelineConfig.CdWorkflow
599
599
preDeploySteps = prePostAndRefPluginResponse .PreStageSteps
600
600
refPluginsData = prePostAndRefPluginResponse .RefPluginData
601
601
variableSnapshot = prePostAndRefPluginResponse .VariableSnapshot
602
- } else if runner .WorkflowType == bean2 .CD_WORKFLOW_TYPE_POST {
602
+ } else if runner .WorkflowType == apiBean .CD_WORKFLOW_TYPE_POST {
603
603
// TODO: use const from pipeline.WorkflowService:96
604
604
request := pipelineConfigBean .NewBuildPrePostStepDataReq (cdPipeline .Id , "postCD" , scope )
605
605
prePostAndRefPluginResponse , err := impl .pipelineStageService .BuildPrePostAndRefPluginStepsDataForWfRequest (request )
@@ -630,9 +630,9 @@ func (impl *HandlerServiceImpl) buildWFRequest(runner *pipelineConfig.CdWorkflow
630
630
}
631
631
} else {
632
632
//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 {
634
634
stageYaml = cdPipeline .PreStageConfig
635
- } else if runner .WorkflowType == bean2 .CD_WORKFLOW_TYPE_POST {
635
+ } else if runner .WorkflowType == apiBean .CD_WORKFLOW_TYPE_POST {
636
636
stageYaml = cdPipeline .PostStageConfig
637
637
deployStageWfr , deployStageTriggeredByUserEmail , pipelineReleaseCounter , err = impl .getDeployStageDetails (cdPipeline .Id )
638
638
if err != nil {
@@ -813,11 +813,11 @@ func (impl *HandlerServiceImpl) buildWFRequest(runner *pipelineConfig.CdWorkflow
813
813
// For Pre-CD / Post-CD workflow, cache is not uploaded; hence no need to set cache bucket
814
814
cdWorkflowConfigCdCacheBucket := ""
815
815
816
- if runner .WorkflowType == bean2 .CD_WORKFLOW_TYPE_PRE {
816
+ if runner .WorkflowType == apiBean .CD_WORKFLOW_TYPE_PRE {
817
817
// populate input variables of steps with extra env variables
818
818
setExtraEnvVariableInDeployStep (preDeploySteps , runtimeParams .GetSystemVariables (), webhookAndCiData )
819
819
cdStageWorkflowRequest .PrePostDeploySteps = preDeploySteps
820
- } else if runner .WorkflowType == bean2 .CD_WORKFLOW_TYPE_POST {
820
+ } else if runner .WorkflowType == apiBean .CD_WORKFLOW_TYPE_POST {
821
821
// populate input variables of steps with extra env variables
822
822
setExtraEnvVariableInDeployStep (postDeploySteps , runtimeParams .GetSystemVariables (), webhookAndCiData )
823
823
cdStageWorkflowRequest .PrePostDeploySteps = postDeploySteps
@@ -1007,7 +1007,7 @@ func setExtraEnvVariableInDeployStep(deploySteps []*pipelineConfigBean.StepObjec
1007
1007
func (impl * HandlerServiceImpl ) getDeployStageDetails (pipelineId int ) (pipelineConfig.CdWorkflowRunner , string , int , error ) {
1008
1008
deployStageWfr := pipelineConfig.CdWorkflowRunner {}
1009
1009
//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 )
1011
1011
if err != nil {
1012
1012
impl .logger .Errorw ("error in getting latest status of deploy type wfr by pipelineId" , "err" , err , "pipelineId" , pipelineId )
1013
1013
return deployStageWfr , "" , 0 , err
@@ -1046,14 +1046,14 @@ func ReplaceImageTagWithDigest(image, digest string) string {
1046
1046
}
1047
1047
1048
1048
func (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 )
1050
1050
if err != nil {
1051
1051
return err
1052
1052
}
1053
1053
1054
1054
event , _ := impl .eventFactory .Build (util2 .Trigger , & pipeline .Id , pipeline .AppId , & pipeline .EnvironmentId , util2 .CD )
1055
1055
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 )
1057
1057
_ , span := otel .Tracer ("orchestrator" ).Start (ctx , "eventClient.WriteNotificationEvent" )
1058
1058
_ , evtErr := impl .eventClient .WriteNotificationEvent (event )
1059
1059
span .End ()
0 commit comments