Skip to content

Commit

Permalink
update workflow type
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashish-devtron committed Aug 14, 2023
1 parent b3a4682 commit d93ea13
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pkg/pipeline/ArgoWorkflowExecutor.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,13 @@ func (impl *ArgoWorkflowExecutorImpl) ExecuteWorkflow(workflowTemplate bean.Work

entryPoint := workflowTemplate.WorkflowType
// get cm and cs argo step templates
templates, err := impl.getArgoTemplates(workflowTemplate.ConfigMaps, workflowTemplate.Secrets, workflowTemplate.WorkflowType == CiStage)
templates, err := impl.getArgoTemplates(workflowTemplate.ConfigMaps, workflowTemplate.Secrets, workflowTemplate.WorkflowType == CI_WORKFLOW_NAME)
if err != nil {
impl.logger.Errorw("error occurred while fetching argo templates and steps", "err", err)
return nil, err
}
if len(templates) > 0 {
if workflowTemplate.WorkflowType == CiStage {
if workflowTemplate.WorkflowType == CI_WORKFLOW_NAME {
entryPoint = CI_WORKFLOW_WITH_STAGES
} else {
entryPoint = CD_WORKFLOW_WITH_STAGES
Expand Down
2 changes: 1 addition & 1 deletion pkg/pipeline/WorkflowService.go
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ func (impl *WorkflowServiceImpl) createWorkflowTemplate(workflowRequest *Workflo

clusterConfig, err := impl.getClusterConfig(workflowRequest)
workflowTemplate.ClusterConfig = clusterConfig
workflowTemplate.WorkflowType = workflowRequest.GetEventTypeForWorkflowRequest()
workflowTemplate.WorkflowType = workflowRequest.GetWorkflowTypeForWorkflowRequest()
return workflowTemplate, nil
}

Expand Down
13 changes: 13 additions & 0 deletions pkg/pipeline/WorkflowUtils.go
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,19 @@ func (workflowRequest *WorkflowRequest) GetEventTypeForWorkflowRequest() string
}
}

func (workflowRequest *WorkflowRequest) GetWorkflowTypeForWorkflowRequest() string {
switch workflowRequest.Type {
case bean.CI_WORKFLOW_PIPELINE_TYPE:
return CI_WORKFLOW_NAME
case bean.JOB_WORKFLOW_PIPELINE_TYPE:
return CI_WORKFLOW_NAME
case bean.CD_WORKFLOW_PIPELINE_TYPE:
return CD_WORKFLOW_NAME
default:
return ""
}
}

func (workflowRequest *WorkflowRequest) getContainerEnvVariables(config *CiCdConfig, workflowJson []byte) (containerEnvVariables []v12.EnvVar) {
if workflowRequest.Type == bean.CI_WORKFLOW_PIPELINE_TYPE ||
workflowRequest.Type == bean.JOB_WORKFLOW_PIPELINE_TYPE {
Expand Down

0 comments on commit d93ea13

Please sign in to comment.