diff --git a/internal/pkg/argocd/argocd.go b/internal/pkg/argocd/argocd.go index d4b689f..c4ef803 100644 --- a/internal/pkg/argocd/argocd.go +++ b/internal/pkg/argocd/argocd.go @@ -521,7 +521,9 @@ func generateDiffOfAComponent(ctx context.Context, commentDiff bool, componentPa log.Debugf("Generating diff for component %s", componentPath) componentDiffResult.HasDiff, componentDiffResult.DiffElements, componentDiffResult.DiffError = generateArgocdAppDiff(ctx, commentDiff, app, detailedProject.Project, resources, argoSettings, diffOption) - if componentDiffResult.AppWasTemporarilyCreated { + // only delete the temprorary app object if it was created and there was no error on diff + // otherwise let's keep it for investigation + if componentDiffResult.AppWasTemporarilyCreated && componentDiffResult.DiffError == nil { // Delete the temporary app object _, err = ac.app.Delete(ctx, &application.ApplicationDeleteRequest{Name: &app.Name, AppNamespace: &app.Namespace}) if err != nil { diff --git a/templates/argoCD-diff-pr-comment.gotmpl b/templates/argoCD-diff-pr-comment.gotmpl index d6745b8..95b5b8e 100644 --- a/templates/argoCD-diff-pr-comment.gotmpl +++ b/templates/argoCD-diff-pr-comment.gotmpl @@ -4,8 +4,12 @@ Diff of ArgoCD applications: {{if $appDiffResult.DiffError }} -⚠️ ⚠️ **Error getting diff from ArgoCD** (`{{ $appDiffResult.ComponentPath }}`) ⚠️ ⚠️ -``` +⚠️ ⚠️ **Error getting diff from ArgoCD** (`{{ $appDiffResult.ComponentPath }}`) ⚠️ ⚠️ +Please check the App Conditions of **[{{ $appDiffResult.ArgoCdAppName }}]({{ $appDiffResult.ArgoCdAppURL }})** for more details. +{{- if $appDiffResult.AppWasTemporarilyCreated }} +⚠️ For investigation we kept the temporary application, please make sure to clean it up later! ⚠️ +{{- end}} +``` {{ $appDiffResult.DiffError }} ```