@@ -34,8 +34,8 @@ import (
3434 "github.com/devtron-labs/devtron/pkg/k8s"
3535 repository3 "github.com/devtron-labs/devtron/pkg/pipeline/history/repository"
3636 repository5 "github.com/devtron-labs/devtron/pkg/pipeline/repository"
37+ "github.com/devtron-labs/devtron/pkg/resourceQualifiers"
3738 "github.com/devtron-labs/devtron/pkg/variables"
38- "github.com/devtron-labs/devtron/pkg/variables/parsers"
3939 _ "github.com/devtron-labs/devtron/pkg/variables/repository"
4040 "github.com/devtron-labs/devtron/util/argo"
4141 "go.opentelemetry.io/otel"
@@ -160,10 +160,7 @@ type AppServiceImpl struct {
160160 globalEnvVariables * util2.GlobalEnvVariables
161161 manifestPushConfigRepository repository5.ManifestPushConfigRepository
162162 GitOpsManifestPushService GitOpsPushService
163- variableSnapshotHistoryService variables.VariableSnapshotHistoryService
164- scopedVariableService variables.ScopedVariableService
165- variableEntityMappingService variables.VariableEntityMappingService
166- variableTemplateParser parsers.VariableTemplateParser
163+ scopedVariableManager variables.ScopedVariableCMCSManager
167164 argoClientWrapperService argocdServer.ArgoClientWrapperService
168165}
169166
@@ -174,7 +171,7 @@ type AppService interface {
174171 //TriggerCD(artifact *repository.CiArtifact, cdWorkflowId, wfrId int, pipeline *pipelineConfig.Pipeline, triggeredAt time.Time) error
175172 GetConfigMapAndSecretJson (appId int , envId int , pipelineId int ) ([]byte , error )
176173 UpdateCdWorkflowRunnerByACDObject (app * v1alpha1.Application , cdWfrId int , updateTimedOutStatus bool ) error
177- GetCmSecretNew (appId int , envId int , isJob bool ) (* bean.ConfigMapJson , * bean.ConfigSecretJson , error )
174+ GetCmSecretNew (appId int , envId int , isJob bool , scope resourceQualifiers. Scope ) (* bean.ConfigMapJson , * bean.ConfigSecretJson , error )
178175 //MarkImageScanDeployed(appId int, envId int, imageDigest string, clusterId int, isScanEnabled bool) error
179176 UpdateDeploymentStatusForGitOpsPipelines (app * v1alpha1.Application , statusTime time.Time , isAppStore bool ) (bool , bool , * chartConfig.PipelineOverride , error )
180177 WriteCDSuccessEvent (appId int , envId int , override * chartConfig.PipelineOverride )
@@ -245,11 +242,8 @@ func NewAppService(
245242 globalEnvVariables * util2.GlobalEnvVariables , helmAppService client2.HelmAppService ,
246243 manifestPushConfigRepository repository5.ManifestPushConfigRepository ,
247244 GitOpsManifestPushService GitOpsPushService ,
248- variableSnapshotHistoryService variables.VariableSnapshotHistoryService ,
249- scopedVariableService variables.ScopedVariableService ,
250- variableEntityMappingService variables.VariableEntityMappingService ,
251- variableTemplateParser parsers.VariableTemplateParser ,
252245 argoClientWrapperService argocdServer.ArgoClientWrapperService ,
246+ scopedVariableManager variables.ScopedVariableCMCSManager ,
253247) * AppServiceImpl {
254248 appServiceImpl := & AppServiceImpl {
255249 environmentConfigRepository : environmentConfigRepository ,
@@ -311,11 +305,8 @@ func NewAppService(
311305 helmAppService : helmAppService ,
312306 manifestPushConfigRepository : manifestPushConfigRepository ,
313307 GitOpsManifestPushService : GitOpsManifestPushService ,
314- variableSnapshotHistoryService : variableSnapshotHistoryService ,
315- scopedVariableService : scopedVariableService ,
316- variableEntityMappingService : variableEntityMappingService ,
317- variableTemplateParser : variableTemplateParser ,
318308 argoClientWrapperService : argoClientWrapperService ,
309+ scopedVariableManager : scopedVariableManager ,
319310 }
320311 return appServiceImpl
321312}
@@ -1122,7 +1113,7 @@ func (impl *AppServiceImpl) autoHealChartLocationInChart(ctx context.Context, en
11221113}
11231114
11241115// FIXME tmp workaround
1125- func (impl * AppServiceImpl ) GetCmSecretNew (appId int , envId int , isJob bool ) (* bean.ConfigMapJson , * bean.ConfigSecretJson , error ) {
1116+ func (impl * AppServiceImpl ) GetCmSecretNew (appId int , envId int , isJob bool , scope resourceQualifiers. Scope ) (* bean.ConfigMapJson , * bean.ConfigSecretJson , error ) {
11261117 var configMapJson string
11271118 var secretDataJson string
11281119 var configMapJsonApp string
@@ -1187,7 +1178,13 @@ func (impl *AppServiceImpl) GetCmSecretNew(appId int, envId int, isJob bool) (*b
11871178 return nil , nil , err
11881179 }
11891180 }
1190- return & configResponse , & secretResponse , nil
1181+
1182+ resolvedConfigResponse , resolvedSecretResponse , err := impl .scopedVariableManager .ResolveForPrePostStageTrigger (scope , configResponse , secretResponse , configMapA .Id , configMapE .Id )
1183+ if err != nil {
1184+ return nil , nil , err
1185+ }
1186+
1187+ return resolvedConfigResponse , resolvedSecretResponse , nil
11911188}
11921189
11931190// depricated
0 commit comments