From 8e4698049d7c39134499f15c7d73c09f8e819789 Mon Sep 17 00:00:00 2001
From: Sebastian Poxhofer <secustor@users.noreply.github.com>
Date: Fri, 12 Jul 2024 09:24:37 +0200
Subject: [PATCH] fix(helmfile): remove templates before running updating
 artifacts (#30139)

---
 lib/modules/manager/helmfile/artifacts.spec.ts |  3 +++
 lib/modules/manager/helmfile/artifacts.ts      | 10 +++++-----
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/lib/modules/manager/helmfile/artifacts.spec.ts b/lib/modules/manager/helmfile/artifacts.spec.ts
index 03ddc3dddc..a6796903f6 100644
--- a/lib/modules/manager/helmfile/artifacts.spec.ts
+++ b/lib/modules/manager/helmfile/artifacts.spec.ts
@@ -40,6 +40,9 @@ releases:
   - name: backstage
     chart: backstage/backstage
     version: 0.12.0
+{{- if eq .Environment.Name "test" }}
+    installed: false
+{{- end }}
   - name: oauth-proxy
     chart: oauth2-proxy/oauth2-proxy
     version: 6.8.0
diff --git a/lib/modules/manager/helmfile/artifacts.ts b/lib/modules/manager/helmfile/artifacts.ts
index 4c4fdb6937..21bcec72e6 100644
--- a/lib/modules/manager/helmfile/artifacts.ts
+++ b/lib/modules/manager/helmfile/artifacts.ts
@@ -13,7 +13,7 @@ import {
 import { getFile } from '../../../util/git';
 import { regEx } from '../../../util/regex';
 import { Result } from '../../../util/result';
-import { Yaml } from '../../../util/schema-utils';
+import { parseSingleYaml } from '../../../util/yaml';
 import { generateHelmEnvs } from '../helmv3/common';
 import type { UpdateArtifact, UpdateArtifactsResult } from '../types';
 import { Doc, LockVersion } from './schema';
@@ -70,10 +70,10 @@ export async function updateArtifacts({
     }
 
     const cmd: string[] = [];
-    const doc = Result.parse(
-      newPackageFileContent,
-      Yaml.pipe(Doc),
-    ).unwrapOrThrow();
+    const doc = parseSingleYaml(newPackageFileContent, {
+      removeTemplates: true,
+      customSchema: Doc,
+    });
 
     for (const value of coerceArray(doc.repositories).filter(isOCIRegistry)) {
       const loginCmd = await generateRegistryLoginCmd(
-- 
GitLab