@@ -113,7 +113,7 @@ type CdPipelineConfigService interface {
113
113
GetBulkActionImpactedPipelines (dto * bean.CdBulkActionRequestDto ) ([]* pipelineConfig.Pipeline , error ) //no usage
114
114
// IsGitOpsRequiredForCD : Determine if GitOps is required for CD based on the provided pipeline creation request
115
115
IsGitOpsRequiredForCD (pipelineCreateRequest * bean.CdPipelines ) bool
116
- MarkGitOpsDevtronAppsDeletedWhereArgoAppIsDeleted (appId int , envId int , acdToken string , pipeline * pipelineConfig.Pipeline ) (bool , error )
116
+ MarkGitOpsDevtronAppsDeletedWhereArgoAppIsDeleted (acdToken string , pipeline * pipelineConfig.Pipeline ) (bool , error )
117
117
// GetEnvironmentListForAutocompleteFilter : lists environment for given configuration
118
118
GetEnvironmentListForAutocompleteFilter (envName string , clusterIds []int , offset int , size int , token string , checkAuthBatch func (token string , appObject []string , envObject []string ) (map [string ]bool , map [string ]bool ), ctx context.Context ) (* clutserBean.ResourceGroupingResponse , error )
119
119
RegisterInACD (ctx context.Context , chartGitAttr * commonBean.ChartGitAttribute , userId int32 ) error
@@ -824,7 +824,7 @@ func (impl *CdPipelineConfigServiceImpl) DeleteCdPipeline(pipeline *pipelineConf
824
824
if pipeline .DeploymentAppCreated == true {
825
825
deploymentAppName := fmt .Sprintf ("%s-%s" , pipeline .App .AppName , pipeline .Environment .Name )
826
826
if util .IsAcdApp (pipeline .DeploymentAppType ) {
827
- if ! deleteResponse .ClusterReachable {
827
+ if ! forceDelete && ! deleteResponse .ClusterReachable {
828
828
impl .logger .Errorw ("cluster connection error" , "err" , clusterBean .ErrorInConnecting )
829
829
if cascadeDelete {
830
830
return deleteResponse , nil
@@ -1427,7 +1427,7 @@ func (impl *CdPipelineConfigServiceImpl) IsGitOpsRequiredForCD(pipelineCreateReq
1427
1427
return haveAtLeastOneGitOps
1428
1428
}
1429
1429
1430
- func (impl * CdPipelineConfigServiceImpl ) MarkGitOpsDevtronAppsDeletedWhereArgoAppIsDeleted (appId int , envId int , acdToken string , pipeline * pipelineConfig.Pipeline ) (bool , error ) {
1430
+ func (impl * CdPipelineConfigServiceImpl ) MarkGitOpsDevtronAppsDeletedWhereArgoAppIsDeleted (acdToken string , pipeline * pipelineConfig.Pipeline ) (bool , error ) {
1431
1431
1432
1432
acdAppFound := false
1433
1433
ctx := context .Background ()
@@ -1985,7 +1985,7 @@ func (impl *CdPipelineConfigServiceImpl) DeleteCdPipelinePartial(pipeline *pipel
1985
1985
if pipeline .DeploymentAppCreated && ! pipeline .DeploymentAppDeleteRequest {
1986
1986
deploymentAppName := fmt .Sprintf ("%s-%s" , pipeline .App .AppName , pipeline .Environment .Name )
1987
1987
if util .IsAcdApp (pipeline .DeploymentAppType ) {
1988
- if ! deleteResponse .ClusterReachable {
1988
+ if ! forceDelete && ! deleteResponse .ClusterReachable {
1989
1989
impl .logger .Errorw ("cluster connection error" , "err" , clusterBean .ErrorInConnecting )
1990
1990
if cascadeDelete {
1991
1991
return deleteResponse , nil
@@ -2018,10 +2018,7 @@ func (impl *CdPipelineConfigServiceImpl) DeleteCdPipelinePartial(pipeline *pipel
2018
2018
}
2019
2019
}
2020
2020
impl .logger .Infow ("app deleted from argocd" , "id" , pipeline .Id , "pipelineName" , pipeline .Name , "app" , deploymentAppName )
2021
- pipeline .DeploymentAppDeleteRequest = true
2022
- pipeline .UpdatedOn = time .Now ()
2023
- pipeline .UpdatedBy = userId
2024
- err = impl .pipelineRepository .Update (pipeline , tx )
2021
+ err = impl .pipelineRepository .MarkPartiallyDeleted (pipeline .Id , userId , tx )
2025
2022
if err != nil {
2026
2023
impl .logger .Errorw ("error in partially delete cd pipeline" , "err" , err )
2027
2024
return deleteResponse , err
0 commit comments