diff --git a/pkg/chart/ChartService.go b/pkg/chart/ChartService.go index 8e7b69e227..419aac1720 100644 --- a/pkg/chart/ChartService.go +++ b/pkg/chart/ChartService.go @@ -663,12 +663,6 @@ func (impl *ChartServiceImpl) UpdateAppOverride(ctx context.Context, templateReq return nil, err } - err = impl.updateChartLocationForEnvironmentConfigs(newCtx, templateRequest.AppId, templateRequest.ChartRefId, templateRequest.UserId, template.ChartVersion) - if err != nil { - impl.logger.Errorw("error in updating chart location in env overrides", "appId", templateRequest.AppId, "err", err) - return nil, err - } - } else { return nil, nil } @@ -725,6 +719,14 @@ func (impl *ChartServiceImpl) UpdateAppOverride(ctx context.Context, templateReq return nil, err } + if currentLatestChart.Id != 0 && currentLatestChart.Id != templateRequest.Id { + err = impl.updateChartLocationForEnvironmentConfigs(newCtx, templateRequest.AppId, templateRequest.ChartRefId, templateRequest.UserId, template.ChartVersion) + if err != nil { + impl.logger.Errorw("error in updating chart location in env overrides", "appId", templateRequest.AppId, "err", err) + return nil, err + } + } + appLevelMetricsUpdateReq := &bean.DeployedAppMetricsRequest{ EnableMetrics: templateRequest.IsAppMetricsEnabled, AppId: templateRequest.AppId,