Skip to content
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
6 changes: 3 additions & 3 deletions pkg/deployment/trigger/devtronApps/TriggerService.go
Original file line number Diff line number Diff line change
Expand Up @@ -1029,7 +1029,7 @@ func (impl *TriggerServiceImpl) deployArgocdApp(overrideRequest *bean3.ValuesOve
impl.logger.Debugw("argocd application created", "name", name)

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

// update repoUrl, revision and argo app sync mode (auto/manual) if needed
func (impl *TriggerServiceImpl) updateArgoPipeline(pipeline *pipelineConfig.Pipeline, envOverride *chartConfig.EnvConfigOverride, ctx context.Context) (bool, error) {
func (impl *TriggerServiceImpl) updateArgoPipeline(ctx context.Context, pipeline *pipelineConfig.Pipeline, envOverride *chartConfig.EnvConfigOverride) (bool, error) {
if ctx == nil {
impl.logger.Errorw("err in syncing ACD, ctx is NULL", "pipelineName", pipeline.Name)
return false, nil
}
argoAppName := pipeline.DeploymentAppName
impl.logger.Infow("received payload, updateArgoPipeline", "appId", pipeline.AppId, "pipelineName", pipeline.Name, "envId", envOverride.TargetEnvironment, "argoAppName", argoAppName, "context", ctx)
impl.logger.Infow("received payload, updateArgoPipeline", "appId", pipeline.AppId, "pipelineName", pipeline.Name, "envId", envOverride.TargetEnvironment, "argoAppName", argoAppName)
argoApplication, err := impl.argoClientWrapperService.GetArgoAppByName(ctx, argoAppName)
if err != nil {
impl.logger.Errorw("no argo app exists", "app", argoAppName, "pipeline", pipeline.Name)
Expand Down
14 changes: 8 additions & 6 deletions pkg/eventProcessor/in/WorkflowEventProcessorService.go
Original file line number Diff line number Diff line change
Expand Up @@ -795,12 +795,14 @@ func (impl *WorkflowEventProcessorImpl) SubscribeCDPipelineDeleteEvent() error {
impl.logger.Errorw("error in fetching pipeline by pipelineId", "err", err, "pipelineId", cdPipelineDeleteEvent.PipelineId)
return
}
impl.RemoveReleaseContextForPipeline(cdPipelineDeleteEvent)
//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
//trying to delete deployment app once
err = impl.cdPipelineConfigService.DeleteHelmTypePipelineDeploymentApp(context.Background(), true, pipeline)
if err != nil {
impl.logger.Errorw("error, DeleteHelmTypePipelineDeploymentApp", "pipelineId", pipeline.Id)
if pipeline.DeploymentAppType == bean5.Helm {
impl.RemoveReleaseContextForPipeline(cdPipelineDeleteEvent)
//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
//trying to delete deployment app once
err = impl.cdPipelineConfigService.DeleteHelmTypePipelineDeploymentApp(context.Background(), true, pipeline)
if err != nil {
impl.logger.Errorw("error, DeleteHelmTypePipelineDeploymentApp", "pipelineId", pipeline.Id)
}
}
}
// add required logging here
Expand Down