Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: refactoring deployment app name usage #5702

Merged
merged 28 commits into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
8d34a07
removing hard coded deployment app name
iamayushm Jul 31, 2024
ca432b7
Merge remote-tracking branch 'origin/main' into refactoring-deploymen…
iamayushm Aug 5, 2024
64a9acb
removing %s-%s usage
iamayushm Aug 5, 2024
5b09a4d
wip: query change for enterprise
iamayushm Aug 5, 2024
bea16b8
wip
iamayushm Aug 7, 2024
6cf48e7
wip
iamayushm Aug 7, 2024
b1316a1
wip
iamayushm Aug 8, 2024
86fcc6f
adding release mode in deployment config
iamayushm Aug 8, 2024
1347c3b
wip: release changes
iamayushm Aug 8, 2024
9d703fc
left join on pco and artifact
iamayushm Aug 8, 2024
f7acfcd
handling empty release mode - backward compatibility
iamayushm Aug 8, 2024
230fdf4
Merge remote-tracking branch 'origin/main' into refactoring-deploymen…
iamayushm Aug 9, 2024
470fb66
fixing panic
iamayushm Aug 9, 2024
34c6354
main merge
iamayushm Aug 9, 2024
04d5baa
Merge remote-tracking branch 'origin/main' into refactoring-deploymen…
iamayushm Aug 9, 2024
07c4c20
main merge
iamayushm Aug 14, 2024
779e913
migration number changes (#5692)
prakash100198 Aug 15, 2024
4f04d6b
refrain from checkin autoscalingCheckBeforeTrigger for virt clus (#5696)
prakash100198 Aug 20, 2024
2e58e77
fix: Decode secret fix on add update oss (#5695)
prakash100198 Aug 20, 2024
bf23515
saving pco concurrency case handled (#5688)
prakash100198 Aug 20, 2024
b64fba4
migration updated
iamayushm Aug 20, 2024
722d814
Merge remote-tracking branch 'origin/main' into refactoring-deploymen…
iamayushm Aug 20, 2024
bffa909
main merge and migration script updated
iamayushm Aug 20, 2024
a4403a2
Merge remote-tracking branch 'origin/develop' into refactoring-deploy…
iamayushm Aug 21, 2024
1e4ebd7
Merge remote-tracking branch 'origin/develop' into refactoring-deploy…
iamayushm Aug 22, 2024
17433c1
wip
iamayushm Aug 22, 2024
69d8e52
review changes
iamayushm Aug 22, 2024
013b71b
fix sql no
iamayushm Aug 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions api/bean/AppView.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ type AppEnvironmentContainer struct {
type DeploymentDetailContainer struct {
InstalledAppId int `json:"installedAppId,omitempty"`
AppId int `json:"appId,omitempty"`
PcoId int `json:"pcoId"`
CdPipelineId int `json:"cdPipelineId,omitempty"`
TriggerType string `json:"triggerType,omitempty"`
ParentEnvironmentName string `json:"parentEnvironmentName"`
Expand Down Expand Up @@ -183,6 +184,8 @@ type DeploymentDetailContainer struct {
HelmPackageName string `json:"helmPackageName"`
HelmReleaseInstallStatus string `json:"-"`
DeploymentConfig *bean.DeploymentConfig `json:"-"`
IsPipelineTriggered bool `json:"isPipelineTriggered"`
ReleaseMode string `json:"releaseMode"`
}

type AppDetailContainer struct {
Expand Down
194 changes: 100 additions & 94 deletions api/helm-app/gRPC/applist.pb.go

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions api/helm-app/gRPC/applist.proto
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ service ApplicationService {
rpc ValidateOCIRegistry(RegistryCredential) returns(OCIRegistryResponse) {}
rpc GetResourceTreeForExternalResources(ExternalResourceTreeRequest) returns(ResourceTreeResponse){}
rpc GetFluxAppDetail(FluxAppDetailRequest)returns(FluxAppDetail){}
rpc GetReleaseDetails(ReleaseIdentifier)returns(DeployedAppDetail){}

}

Expand Down
158 changes: 111 additions & 47 deletions api/helm-app/gRPC/applist_grpc.pb.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion api/helm-app/service/HelmAppService.go
Original file line number Diff line number Diff line change
Expand Up @@ -1136,7 +1136,7 @@ func (impl *HelmAppServiceImpl) appListRespProtoTransformer(deployedApps *gRPC.D
// do not add app in the list which are created using cd_pipelines (check combination of clusterId, namespace, releaseName)
var toExcludeFromList bool
for _, helmCdPipeline := range helmCdPipelines {
helmAppReleaseName := util2.BuildDeployedAppName(helmCdPipeline.App.AppName, helmCdPipeline.Environment.Name)
helmAppReleaseName := helmCdPipeline.DeploymentAppName
if deployedapp.AppName == helmAppReleaseName && int(deployedapp.EnvironmentDetail.ClusterId) == helmCdPipeline.Environment.ClusterId && deployedapp.EnvironmentDetail.Namespace == helmCdPipeline.Environment.Namespace {
toExcludeFromList = true
break
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,11 @@ func (handler *PipelineConfigRestHandlerImpl) CreateCdPipeline(w http.ResponseWr
handler.Logger.Infow("request payload, CreateCdPipeline", "payload", cdPipeline)
userUploaded, err := handler.chartService.CheckIfChartRefUserUploadedByAppId(cdPipeline.AppId)
if !userUploaded {
for i, p := range cdPipeline.Pipelines {
if len(p.ReleaseMode) == 0 {
cdPipeline.Pipelines[i].ReleaseMode = util.PIPELINE_RELEASE_MODE_CREATE
}
}
err = handler.validator.Struct(cdPipeline)
if err != nil {
handler.Logger.Errorw("validation err, CreateCdPipeline", "err", err, "payload", cdPipeline)
Expand Down
25 changes: 17 additions & 8 deletions internal/sql/repository/AppListingRepository.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"github.com/devtron-labs/devtron/internal/middleware"
appWorkflow2 "github.com/devtron-labs/devtron/internal/sql/repository/appWorkflow"
"github.com/devtron-labs/devtron/internal/sql/repository/deploymentConfig"
"github.com/devtron-labs/devtron/internal/util"
repository2 "github.com/devtron-labs/devtron/pkg/cluster/repository"
"go.opentelemetry.io/otel"
"strings"
Expand Down Expand Up @@ -365,10 +366,10 @@ func (impl AppListingRepositoryImpl) deploymentDetailsByAppIdAndEnvId(ctx contex
" p.ci_pipeline_id," +
" p.trigger_type" +
" FROM pipeline p" +
" INNER JOIN pipeline_config_override pco on pco.pipeline_id=p.id" +
" LEFT JOIN pipeline_config_override pco on pco.pipeline_id=p.id" +
" INNER JOIN environment env ON env.id=p.environment_id" +
" INNER JOIN cluster cl on cl.id=env.cluster_id" +
" INNER JOIN ci_artifact cia on cia.id = pco.ci_artifact_id" +
" LEFT JOIN ci_artifact cia on cia.id = pco.ci_artifact_id" +
" INNER JOIN app a ON a.id=p.app_id" +
" WHERE a.app_type = 0 AND a.id=? AND env.id=? AND p.deleted = FALSE AND env.active = TRUE" +
" ORDER BY pco.created_on DESC LIMIT 1;"
Expand All @@ -378,13 +379,18 @@ func (impl AppListingRepositoryImpl) deploymentDetailsByAppIdAndEnvId(ctx contex
return deploymentDetail, err
}
deploymentDetail.EnvironmentId = envId
if len(deploymentDetail.DeploymentAppType) == 0 {
dc, err := impl.deploymentConfigRepository.GetByAppIdAndEnvId(appId, envId)
if err != nil {
impl.Logger.Errorw("error in getting deployment config by appId and envId", "appId", appId, "envId", envId, "err", err)
return deploymentDetail, err
}

deploymentDetail.EnvironmentId = envId
dc, err := impl.deploymentConfigRepository.GetByAppIdAndEnvId(appId, envId)
if err != nil && err != pg.ErrNoRows {
impl.Logger.Errorw("error in getting deployment config by appId and envId", "appId", appId, "envId", envId, "err", err)
return deploymentDetail, err
}
if err == pg.ErrNoRows {
deploymentDetail.ReleaseMode = util.PIPELINE_RELEASE_MODE_CREATE
} else {
deploymentDetail.DeploymentAppType = dc.DeploymentAppType
deploymentDetail.ReleaseMode = dc.ReleaseMode
}

return deploymentDetail, nil
Expand Down Expand Up @@ -455,6 +461,9 @@ func (impl AppListingRepositoryImpl) FetchAppDetail(ctx context.Context, appId i
if err != nil {
impl.Logger.Warn("unable to fetch deployment detail for app")
}
if deploymentDetail.PcoId > 0 {
deploymentDetail.IsPipelineTriggered = true
}
appWfMapping, _ := impl.appWorkflowRepository.FindWFCDMappingByCDPipelineId(deploymentDetail.CdPipelineId)
if appWfMapping.ParentType == appWorkflow2.CDPIPELINE {
parentEnvironmentName, _ := impl.getEnvironmentNameFromPipelineId(appWfMapping.ParentId)
Expand Down
1 change: 1 addition & 0 deletions internal/sql/repository/deploymentConfig/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ type DeploymentConfig struct {
ConfigType string `sql:"config_type"`
RepoUrl string `sql:"repo_url"`
RepoName string `sql:"repo_name"`
ReleaseMode string `json:"release_mode"`
Active bool `sql:"active,notnull"`
sql.AuditLog
}
Expand Down
4 changes: 4 additions & 0 deletions internal/util/ChartTemplateService.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ const (
CHART_WORKING_DIR_PATH = "/tmp/charts/"
)

const (
PIPELINE_RELEASE_MODE_CREATE = "create"
)

type ChartCreateRequest struct {
ChartMetaData *chart.Metadata
ChartPath string
Expand Down
1 change: 1 addition & 0 deletions pkg/bean/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,7 @@ type CDPipelineConfigObject struct {
ChildPipelineId int `json:"childPipelineId"`
IsDigestEnforcedForPipeline bool `json:"isDigestEnforcedForPipeline"`
IsDigestEnforcedForEnv bool `json:"isDigestEnforcedForEnv"`
ReleaseMode string `json:"releaseMode" validate:"oneof=create"`
}

type CDPipelineAddType string
Expand Down
2 changes: 1 addition & 1 deletion pkg/bulkAction/BulkUpdateService.go
Original file line number Diff line number Diff line change
Expand Up @@ -1080,7 +1080,7 @@ func (impl BulkUpdateServiceImpl) buildHibernateUnHibernateRequestForHelmPipelin
return nil, nil, err
}
var group, kind, version, name string
name = fmt.Sprintf("%s-%s", pipeline.App.AppName, pipeline.Environment.Name)
name = pipeline.DeploymentAppName
if chartInfo.Name == bean3.RolloutChartType && chartInfo.UserUploaded == false {
// rollout type chart
group = "argoproj.io"
Expand Down
2 changes: 2 additions & 0 deletions pkg/deployment/common/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ func ConvertDeploymentConfigDTOToDbObj(config *bean.DeploymentConfig) *deploymen
ConfigType: config.ConfigType,
RepoUrl: config.RepoURL,
Active: config.Active,
ReleaseMode: config.ReleaseMode,
}
}

Expand All @@ -26,5 +27,6 @@ func ConvertDeploymentConfigDbObjToDTO(dbObj *deploymentConfig.DeploymentConfig)
ConfigType: dbObj.ConfigType,
RepoURL: dbObj.RepoUrl,
Active: dbObj.Active,
ReleaseMode: dbObj.ReleaseMode,
}
}
1 change: 1 addition & 0 deletions pkg/deployment/common/bean/bean.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ type DeploymentConfig struct {
DeploymentAppType string
RepoURL string
RepoName string
ReleaseMode string
Active bool
}

Expand Down
19 changes: 19 additions & 0 deletions pkg/deployment/common/deploymentConfigService.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
appRepository "github.com/devtron-labs/devtron/internal/sql/repository/app"
"github.com/devtron-labs/devtron/internal/sql/repository/deploymentConfig"
"github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig"
util2 "github.com/devtron-labs/devtron/internal/util"
"github.com/devtron-labs/devtron/pkg/appStore/installedApp/repository"
bean3 "github.com/devtron-labs/devtron/pkg/auth/user/bean"
chartRepoRepository "github.com/devtron-labs/devtron/pkg/chartRepo/repository"
Expand Down Expand Up @@ -101,6 +102,20 @@ func (impl *DeploymentConfigServiceImpl) GetConfigForDevtronApps(appId, envId in
impl.logger.Errorw("error in parsing config from charts and pipeline repository", "appId", appId, "envId", envId, "err", err)
return nil, err
}
if envId > 0 {
// add columns added after migration (of deployment app type and repo url) here
appAndEnvLevelConfig, err := impl.deploymentConfigRepository.GetByAppIdAndEnvId(appId, envId)
if err != nil && err != pg.ErrNoRows {
impl.logger.Errorw("error in getting deployment config db object by appId and envId", "appId", appId, "envId", envId, "err", err)
return nil, err
}
if err == pg.ErrNoRows {
// deployment config is not done
configFromOldData.ReleaseMode = util2.PIPELINE_RELEASE_MODE_CREATE
} else {
configFromOldData.ReleaseMode = appAndEnvLevelConfig.ReleaseMode
}
}
return configFromOldData, nil
}

Expand Down Expand Up @@ -190,6 +205,9 @@ func (impl *DeploymentConfigServiceImpl) GetAndMigrateConfigIfAbsentForDevtronAp
impl.logger.Errorw("error in parsing config from charts and pipeline repository", "appId", appId, "envId", envId, "err", err)
return nil, err
}
if envId > 0 {
configFromOldData.ReleaseMode = envLevelConfig.ReleaseMode
}
return configFromOldData, nil
}

Expand Down Expand Up @@ -256,6 +274,7 @@ func (impl *DeploymentConfigServiceImpl) parseEnvLevelConfigForDevtronApps(appLe
EnvironmentId: envId,
ConfigType: appLevelConfig.ConfigType,
RepoUrl: appLevelConfig.RepoUrl,
ReleaseMode: util2.PIPELINE_RELEASE_MODE_CREATE, //for migration it is always equal to create as migration is happening for old cd pipelines
Active: true,
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/deployment/manifest/ManifestCreationService.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ func (impl *ManifestCreationServiceImpl) GetValuesOverrideForTrigger(overrideReq
appLabelJsonByte = nil
}
mergedValues, err := impl.mergeOverrideValues(envOverride, releaseOverrideJson, configMapJson.MergedJson, appLabelJsonByte, strategy)
appName := fmt.Sprintf("%s-%s", overrideRequest.AppName, envOverride.Environment.Name)
appName := pipeline.DeploymentAppName
var k8sErr error
mergedValues, k8sErr = impl.updatedExternalCmCsHashForTrigger(newCtx, overrideRequest.ClusterId,
envOverride.Namespace, mergedValues, configMapJson.ExternalCmList, configMapJson.ExternalCsList)
Expand Down
14 changes: 0 additions & 14 deletions pkg/deployment/trigger/devtronApps/TriggerService.go
Original file line number Diff line number Diff line change
Expand Up @@ -956,20 +956,6 @@ func (impl *TriggerServiceImpl) buildManifestPushTemplate(overrideRequest *bean3
return manifestPushTemplate, err
}

// getAcdAppGitOpsRepoName returns the GitOps repository name, configured for the argoCd app
func (impl *TriggerServiceImpl) getAcdAppGitOpsRepoName(appName string, environmentName string) (string, error) {
//this method should only call in case of argo-integration and gitops configured
acdToken, err := impl.argoUserService.GetLatestDevtronArgoCdUserToken()
if err != nil {
impl.logger.Errorw("error in getting acd token", "err", err)
return "", err
}
ctx := context.Background()
ctx = context.WithValue(ctx, "token", acdToken)
acdAppName := fmt.Sprintf("%s-%s", appName, environmentName)
return impl.argoClientWrapperService.GetGitOpsRepoName(ctx, acdAppName)
}

func (impl *TriggerServiceImpl) getManifestPushService(triggerEvent bean.TriggerEvent) publish.ManifestPushService {
var manifestPushService publish.ManifestPushService
if triggerEvent.ManifestStorageType == bean2.ManifestStorageGit {
Expand Down
13 changes: 12 additions & 1 deletion pkg/generateManifest/DeploymentTemplateService.go
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,18 @@ func (impl DeploymentTemplateServiceImpl) GetRestartWorkloadData(ctx context.Con
impl.Logger.Errorw("error in fetching environment", "envId", envId, "err", err)
return nil, err
}
installReleaseRequests, err := impl.constructInstallReleaseBulkReq(apps, environment)

pipelineMap := make(map[string]*pipelineConfig.Pipeline)
pipelines, err := impl.pipelineRepository.FindActiveByInFilter(envId, appIds)
if err != nil {
impl.Logger.Errorw("error in getting pipelines by appIds and envId", "appIds", appIds, "envId", envId, "err", err)
return nil, err
}
for _, p := range pipelines {
pipelineMap[fmt.Sprintf("%d-%d", p.AppId, p.EnvironmentId)] = p
}

installReleaseRequests, err := impl.constructInstallReleaseBulkReq(apps, environment, pipelineMap)
if err != nil {
impl.Logger.Errorw("error in fetching installReleaseRequests", "appIds", appIds, "envId", envId, "err", err)
return nil, err
Expand Down
11 changes: 7 additions & 4 deletions pkg/generateManifest/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"github.com/devtron-labs/devtron/api/helm-app/bean"
"github.com/devtron-labs/devtron/api/helm-app/gRPC"
"github.com/devtron-labs/devtron/internal/sql/repository/app"
"github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig"
"github.com/devtron-labs/devtron/pkg/cluster/repository"
"go.opentelemetry.io/otel"
"golang.org/x/exp/maps"
Expand Down Expand Up @@ -67,7 +68,7 @@ func (impl DeploymentTemplateServiceImpl) constructRotatePodResponse(templateCha
return podResp, nil
}

func (impl DeploymentTemplateServiceImpl) constructInstallReleaseBulkReq(apps []*app.App, environment *repository.Environment) ([]*gRPC.InstallReleaseRequest, error) {
func (impl DeploymentTemplateServiceImpl) constructInstallReleaseBulkReq(apps []*app.App, environment *repository.Environment, pipelineMap map[string]*pipelineConfig.Pipeline) ([]*gRPC.InstallReleaseRequest, error) {
appIdToInstallReleaseRequest := make(map[int]*gRPC.InstallReleaseRequest)
installReleaseRequests := make([]*gRPC.InstallReleaseRequest, 0)
var applicationIds []int
Expand Down Expand Up @@ -104,9 +105,10 @@ func (impl DeploymentTemplateServiceImpl) constructInstallReleaseBulkReq(apps []
impl.Logger.Errorw("error in fetching cluster detail", "clusterId", 1, "err", err)
return nil, err
}

for _, app := range apps {
if _, ok := appIdToInstallReleaseRequest[app.Id]; ok {
appIdToInstallReleaseRequest[app.Id].ReleaseIdentifier = impl.getReleaseIdentifier(config, app, environment)
appIdToInstallReleaseRequest[app.Id].ReleaseIdentifier = impl.getReleaseIdentifier(config, app, environment, pipelineMap)
appIdToInstallReleaseRequest[app.Id].K8SVersion = k8sServerVersion.String()
}
}
Expand Down Expand Up @@ -140,10 +142,11 @@ func (impl DeploymentTemplateServiceImpl) setChartContent(ctx context.Context, i
return err
}

func (impl DeploymentTemplateServiceImpl) getReleaseIdentifier(config *gRPC.ClusterConfig, app *app.App, env *repository.Environment) *gRPC.ReleaseIdentifier {
func (impl DeploymentTemplateServiceImpl) getReleaseIdentifier(config *gRPC.ClusterConfig, app *app.App, env *repository.Environment, pipelineMap map[string]*pipelineConfig.Pipeline) *gRPC.ReleaseIdentifier {
pipeline := pipelineMap[fmt.Sprintf("%d-%d", app.Id, env.Id)]
return &gRPC.ReleaseIdentifier{
ClusterConfig: config,
ReleaseName: fmt.Sprintf("%s-%s", app.AppName, env.Name),
ReleaseName: pipeline.DeploymentAppName,
ReleaseNamespace: env.Namespace,
}
}
Expand Down
22 changes: 10 additions & 12 deletions pkg/pipeline/AppDeploymentTypeChangeManager.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ func (impl *AppDeploymentTypeChangeManagerImpl) ChangePipelineDeploymentType(ctx
TriggeredPipelines: make([]*bean.CdPipelineTrigger, 0),
}

var deleteDeploymentType bean3.DeploymentType
var deleteDeploymentType string

if request.DesiredDeploymentType == bean3.ArgoCd {
deleteDeploymentType = bean3.Helm
Expand All @@ -251,12 +251,12 @@ func (impl *AppDeploymentTypeChangeManagerImpl) ChangePipelineDeploymentType(ctx
}

pipelines, err := impl.pipelineRepository.FindActiveByEnvIdAndDeploymentType(request.EnvId,
string(deleteDeploymentType), request.ExcludeApps, request.IncludeApps)
deleteDeploymentType, request.ExcludeApps, request.IncludeApps)

if err != nil {
impl.logger.Errorw("Error fetching cd pipelines",
"environmentId", request.EnvId,
"currentDeploymentAppType", string(deleteDeploymentType),
"currentDeploymentAppTypes", deleteDeploymentType,
"err", err)
return response, err
}
Expand Down Expand Up @@ -334,7 +334,7 @@ func (impl *AppDeploymentTypeChangeManagerImpl) TriggerDeploymentAfterTypeChange
var err error

cdPipelines, err := impl.pipelineRepository.FindActiveByEnvIdAndDeploymentType(request.EnvId,
string(request.DesiredDeploymentType), request.ExcludeApps, request.IncludeApps)
request.DesiredDeploymentType, request.ExcludeApps, request.IncludeApps)

if err != nil {
impl.logger.Errorw("Error fetching cd pipelines",
Expand Down Expand Up @@ -475,11 +475,10 @@ func (impl *AppDeploymentTypeChangeManagerImpl) DeleteDeploymentApps(ctx context
continue
}

deploymentAppName := fmt.Sprintf("%s-%s", pipeline.App.AppName, pipeline.Environment.Name)
// delete request
var err error
if envDeploymentConfig.DeploymentAppType == bean3.ArgoCd {
err = impl.deleteArgoCdApp(ctx, pipeline, deploymentAppName, true)
err = impl.deleteArgoCdApp(ctx, pipeline, pipeline.DeploymentAppName, true)

} else {

Expand Down Expand Up @@ -552,7 +551,7 @@ func (impl *AppDeploymentTypeChangeManagerImpl) DeleteDeploymentApps(ctx context
}
if err != nil {
impl.logger.Errorw("error registering app on ACD with error: "+err.Error(),
"deploymentAppName", deploymentAppName,
"deploymentAppName", pipeline.DeploymentAppName,
"envId", pipeline.EnvironmentId,
"appId", pipeline.AppId,
"err", err)
Expand All @@ -568,7 +567,7 @@ func (impl *AppDeploymentTypeChangeManagerImpl) DeleteDeploymentApps(ctx context

if err != nil {
impl.logger.Errorw("error deleting app on "+envDeploymentConfig.DeploymentAppType,
"deployment app name", deploymentAppName,
"deployment app name", pipeline.DeploymentAppName,
"err", err)

// deletion failed, append to the list of failed pipelines
Expand Down Expand Up @@ -597,7 +596,7 @@ func (impl *AppDeploymentTypeChangeManagerImpl) DeleteDeploymentAppsForEnvironme

// fetch active pipelines from database for the given environment id and current deployment app type
pipelines, err := impl.pipelineRepository.FindActiveByEnvIdAndDeploymentType(environmentId,
string(currentDeploymentAppType), exclusionList, includeApps)
currentDeploymentAppType, exclusionList, includeApps)

deploymentConfigs := make([]*bean4.DeploymentConfig, 0)
for _, p := range pipelines {
Expand Down Expand Up @@ -728,7 +727,6 @@ func (impl *AppDeploymentTypeChangeManagerImpl) fetchDeletedApp(ctx context.Cont
if err != nil {
impl.logger.Errorw("error in fetching environment deployment config by appId and envId", "appId", pipeline.AppId, "envId", pipeline.EnvironmentId, "err", err)
}
deploymentAppName := fmt.Sprintf("%s-%s", pipeline.App.AppName, pipeline.Environment.Name)
if envDeploymentConfig.DeploymentAppType == bean3.ArgoCd {
appIdentifier := &helmBean.AppIdentifier{
ClusterId: pipeline.Environment.ClusterId,
Expand All @@ -738,12 +736,12 @@ func (impl *AppDeploymentTypeChangeManagerImpl) fetchDeletedApp(ctx context.Cont
_, err = impl.helmAppService.GetApplicationDetail(ctx, appIdentifier)
} else {
req := &application.ApplicationQuery{
Name: &deploymentAppName,
Name: &pipeline.DeploymentAppName,
}
_, err = impl.application.Get(ctx, req)
}
if err != nil {
impl.logger.Errorw("error in getting application detail", "err", err, "deploymentAppName", deploymentAppName)
impl.logger.Errorw("error in getting application detail", "err", err, "deploymentAppName", pipeline.DeploymentAppName)
}

if err != nil && checkAppReleaseNotExist(err) {
Expand Down
Loading