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

fix: Running Deployment status of applications in chart groups is not synced #3958

Merged
merged 1 commit into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
17 changes: 16 additions & 1 deletion pkg/appStore/deployment/service/AppStoreDeploymentService.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ func GetDeploymentServiceTypeConfig() (*DeploymentServiceTypeConfig, error) {
type AppStoreDeploymentServiceImpl struct {
logger *zap.SugaredLogger
installedAppRepository repository.InstalledAppRepository
chartGroupDeploymentRepository repository.ChartGroupDeploymentRepository
appStoreApplicationVersionRepository appStoreDiscoverRepository.AppStoreApplicationVersionRepository
environmentRepository clusterRepository.EnvironmentRepository
clusterInstalledAppsRepository repository.ClusterInstalledAppsRepository
Expand All @@ -105,7 +106,7 @@ type AppStoreDeploymentServiceImpl struct {
}

func NewAppStoreDeploymentServiceImpl(logger *zap.SugaredLogger, installedAppRepository repository.InstalledAppRepository,
appStoreApplicationVersionRepository appStoreDiscoverRepository.AppStoreApplicationVersionRepository, environmentRepository clusterRepository.EnvironmentRepository,
chartGroupDeploymentRepository repository.ChartGroupDeploymentRepository, appStoreApplicationVersionRepository appStoreDiscoverRepository.AppStoreApplicationVersionRepository, environmentRepository clusterRepository.EnvironmentRepository,
clusterInstalledAppsRepository repository.ClusterInstalledAppsRepository, appRepository app.AppRepository,
appStoreDeploymentHelmService appStoreDeploymentTool.AppStoreDeploymentHelmService,
appStoreDeploymentArgoCdService appStoreDeploymentGitopsTool.AppStoreDeploymentArgoCdService, environmentService cluster.EnvironmentService,
Expand All @@ -116,6 +117,7 @@ func NewAppStoreDeploymentServiceImpl(logger *zap.SugaredLogger, installedAppRep
return &AppStoreDeploymentServiceImpl{
logger: logger,
installedAppRepository: installedAppRepository,
chartGroupDeploymentRepository: chartGroupDeploymentRepository,
appStoreApplicationVersionRepository: appStoreApplicationVersionRepository,
environmentRepository: environmentRepository,
clusterInstalledAppsRepository: clusterInstalledAppsRepository,
Expand Down Expand Up @@ -796,6 +798,19 @@ func (impl AppStoreDeploymentServiceImpl) DeleteInstalledApp(ctx context.Context
}
}

// soft delete chart-group deployment
chartGroupDeployment, err := impl.chartGroupDeploymentRepository.FindByInstalledAppId(model.Id)
if err != nil {
impl.logger.Errorw("error while fetching chart group deployment", "error", err)
return nil, err
}
chartGroupDeployment.Deleted = true
_, err = impl.chartGroupDeploymentRepository.Update(chartGroupDeployment, tx)
if err != nil {
impl.logger.Errorw("error while updating chart group deployment", "error", err)
return nil, err
}

if util2.IsBaseStack() || util2.IsHelmApp(app.AppOfferingMode) || util.IsHelmApp(model.DeploymentAppType) {
// there might be a case if helm release gets uninstalled from helm cli.
//in this case on deleting the app from API, it should not give error as it should get deleted from db, otherwise due to delete error, db does not get clean
Expand Down
2 changes: 1 addition & 1 deletion wire_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.