From 72c8684599df06eba042cb561986a3bc6c40590d Mon Sep 17 00:00:00 2001 From: jnovick Date: Mon, 1 Jul 2024 16:15:42 +0300 Subject: [PATCH] Create directory automatically (#680) Signed-off-by: Joshua Novick --- pkg/argocd/git.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/argocd/git.go b/pkg/argocd/git.go index 1764a454..d3216d98 100644 --- a/pkg/argocd/git.go +++ b/pkg/argocd/git.go @@ -291,6 +291,12 @@ func writeOverrides(app *v1alpha1.Application, wbc *WriteBackConfig, gitC git.Cl } } + dir := filepath.Dir(targetFile) + err = os.MkdirAll(dir, 0700) + if err != nil { + return + } + err = os.WriteFile(targetFile, override, 0600) if err != nil { return