Skip to content

Commit df5d15f

Browse files
authored
fix for release not found in argo (#4928)
1 parent b9d775b commit df5d15f

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

pkg/deployment/trigger/devtronApps/TriggerService.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,7 +1029,7 @@ func (impl *TriggerServiceImpl) deployArgocdApp(overrideRequest *bean3.ValuesOve
10291029
impl.logger.Debugw("argocd application created", "name", name)
10301030

10311031
_, span = otel.Tracer("orchestrator").Start(ctx, "updateArgoPipeline")
1032-
updateAppInArgocd, err := impl.updateArgoPipeline(valuesOverrideResponse.Pipeline, valuesOverrideResponse.EnvOverride, ctx)
1032+
updateAppInArgocd, err := impl.updateArgoPipeline(ctx, valuesOverrideResponse.Pipeline, valuesOverrideResponse.EnvOverride)
10331033
span.End()
10341034
if err != nil {
10351035
impl.logger.Errorw("error in updating argocd app ", "err", err)
@@ -1068,13 +1068,13 @@ func (impl *TriggerServiceImpl) deployArgocdApp(overrideRequest *bean3.ValuesOve
10681068
}
10691069

10701070
// update repoUrl, revision and argo app sync mode (auto/manual) if needed
1071-
func (impl *TriggerServiceImpl) updateArgoPipeline(pipeline *pipelineConfig.Pipeline, envOverride *chartConfig.EnvConfigOverride, ctx context.Context) (bool, error) {
1071+
func (impl *TriggerServiceImpl) updateArgoPipeline(ctx context.Context, pipeline *pipelineConfig.Pipeline, envOverride *chartConfig.EnvConfigOverride) (bool, error) {
10721072
if ctx == nil {
10731073
impl.logger.Errorw("err in syncing ACD, ctx is NULL", "pipelineName", pipeline.Name)
10741074
return false, nil
10751075
}
10761076
argoAppName := pipeline.DeploymentAppName
1077-
impl.logger.Infow("received payload, updateArgoPipeline", "appId", pipeline.AppId, "pipelineName", pipeline.Name, "envId", envOverride.TargetEnvironment, "argoAppName", argoAppName, "context", ctx)
1077+
impl.logger.Infow("received payload, updateArgoPipeline", "appId", pipeline.AppId, "pipelineName", pipeline.Name, "envId", envOverride.TargetEnvironment, "argoAppName", argoAppName)
10781078
argoApplication, err := impl.argoClientWrapperService.GetArgoAppByName(ctx, argoAppName)
10791079
if err != nil {
10801080
impl.logger.Errorw("no argo app exists", "app", argoAppName, "pipeline", pipeline.Name)

pkg/eventProcessor/in/WorkflowEventProcessorService.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -795,12 +795,14 @@ func (impl *WorkflowEventProcessorImpl) SubscribeCDPipelineDeleteEvent() error {
795795
impl.logger.Errorw("error in fetching pipeline by pipelineId", "err", err, "pipelineId", cdPipelineDeleteEvent.PipelineId)
796796
return
797797
}
798-
impl.RemoveReleaseContextForPipeline(cdPipelineDeleteEvent)
799-
//there is a possibility that when the pipeline was deleted, async request nats message was not consumed completely and could have led to dangling deployment app
800-
//trying to delete deployment app once
801-
err = impl.cdPipelineConfigService.DeleteHelmTypePipelineDeploymentApp(context.Background(), true, pipeline)
802-
if err != nil {
803-
impl.logger.Errorw("error, DeleteHelmTypePipelineDeploymentApp", "pipelineId", pipeline.Id)
798+
if pipeline.DeploymentAppType == bean5.Helm {
799+
impl.RemoveReleaseContextForPipeline(cdPipelineDeleteEvent)
800+
//there is a possibility that when the pipeline was deleted, async request nats message was not consumed completely and could have led to dangling deployment app
801+
//trying to delete deployment app once
802+
err = impl.cdPipelineConfigService.DeleteHelmTypePipelineDeploymentApp(context.Background(), true, pipeline)
803+
if err != nil {
804+
impl.logger.Errorw("error, DeleteHelmTypePipelineDeploymentApp", "pipelineId", pipeline.Id)
805+
}
804806
}
805807
}
806808
// add required logging here

0 commit comments

Comments
 (0)