@@ -30,6 +30,7 @@ import (
30
30
"github.com/devtron-labs/devtron/pkg/infraConfig"
31
31
k8s2 "github.com/devtron-labs/devtron/pkg/k8s"
32
32
bean3 "github.com/devtron-labs/devtron/pkg/pipeline/bean"
33
+ "github.com/devtron-labs/devtron/pkg/pipeline/bean/CiPipeline"
33
34
"github.com/devtron-labs/devtron/pkg/pipeline/executors"
34
35
"github.com/devtron-labs/devtron/pkg/pipeline/infraProviders"
35
36
"github.com/devtron-labs/devtron/pkg/pipeline/types"
@@ -126,10 +127,14 @@ func (impl *WorkflowServiceImpl) createWorkflowTemplate(workflowRequest *types.W
126
127
impl .Logger .Errorw ("error occurred while appending CmCs" , "err" , err )
127
128
return bean3.WorkflowTemplate {}, err
128
129
}
129
- workflowConfigMaps , workflowSecrets , err = impl .addExistingCmCsInWorkflow (workflowRequest , workflowConfigMaps , workflowSecrets )
130
- if err != nil {
131
- impl .Logger .Errorw ("error occurred while adding existing CmCs" , "err" , err )
132
- return bean3.WorkflowTemplate {}, err
130
+
131
+ shouldAddExistingCmCsInWorkflow := impl .shouldAddExistingCmCsInWorkflow (workflowRequest )
132
+ if shouldAddExistingCmCsInWorkflow {
133
+ workflowConfigMaps , workflowSecrets , err = impl .addExistingCmCsInWorkflow (workflowRequest , workflowConfigMaps , workflowSecrets )
134
+ if err != nil {
135
+ impl .Logger .Errorw ("error occurred while adding existing CmCs" , "err" , err )
136
+ return bean3.WorkflowTemplate {}, err
137
+ }
133
138
}
134
139
135
140
workflowTemplate .ConfigMaps = workflowConfigMaps
@@ -176,6 +181,14 @@ func (impl *WorkflowServiceImpl) createWorkflowTemplate(workflowRequest *types.W
176
181
return workflowTemplate , nil
177
182
}
178
183
184
+ func (impl * WorkflowServiceImpl ) shouldAddExistingCmCsInWorkflow (workflowRequest * types.WorkflowRequest ) bool {
185
+ // CmCs are not added for CI_JOB if IgnoreCmCsInCiJob is true
186
+ if workflowRequest .CiPipelineType == string (CiPipeline .CI_JOB ) && impl .ciCdConfig .IgnoreCmCsInCiJob {
187
+ return false
188
+ }
189
+ return true
190
+ }
191
+
179
192
func (impl * WorkflowServiceImpl ) getClusterConfig (workflowRequest * types.WorkflowRequest ) (* rest.Config , error ) {
180
193
env := workflowRequest .Env
181
194
if workflowRequest .IsExtRun {
0 commit comments