From 3ac95a2393c832f454587cab80960ee9b958364a Mon Sep 17 00:00:00 2001
From: Mr Talbot <adamtalbot93@googlemail.com>
Date: Wed, 15 Dec 2021 16:53:44 +0000
Subject: [PATCH] fix: issue where helm index.yaml cannot be read (#13127)

* Fix issue where helm index.yaml cannot be read

The result of this function call is destructured here: https://github.com/renovatebot/renovate/blob/d0d482155dbc8ec6d901105c246fb1542b6a3b00/lib/datasource/helm/index.ts#L65

If the return value is undefiend this causes an error, an empty object satisfies the RepoSource interface and can also be destructured without issue.

* update tests to match helm findSourceUrl behaviour

Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
---
 lib/datasource/helm/common.spec.ts | 2 +-
 lib/datasource/helm/common.ts      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/datasource/helm/common.spec.ts b/lib/datasource/helm/common.spec.ts
index e2f1f32dbf..5cc8818db5 100644
--- a/lib/datasource/helm/common.spec.ts
+++ b/lib/datasource/helm/common.spec.ts
@@ -15,7 +15,7 @@ describe('datasource/helm/common', () => {
       ${'airflow'}  | ${{ sourceUrl: 'https://github.com/bitnami/charts', sourceDirectory: 'bitnami/airflow' }}
       ${'coredns'}  | ${{ sourceUrl: 'https://github.com/coredns/helm', sourceDirectory: undefined }}
       ${'pgadmin4'} | ${{ sourceUrl: 'https://github.com/rowanruseler/helm-charts', sourceDirectory: undefined }}
-      ${'dummy'}    | ${undefined}
+      ${'dummy'}    | ${{}}
     `(
       '$input -> $output',
       ({ input, output }: { input: string; output: string }) => {
diff --git a/lib/datasource/helm/common.ts b/lib/datasource/helm/common.ts
index 26cb20d308..c183ad7c5e 100644
--- a/lib/datasource/helm/common.ts
+++ b/lib/datasource/helm/common.ts
@@ -22,7 +22,7 @@ export function findSourceUrl(release: HelmRelease): RepoSource {
   }
 
   if (!release.sources?.length) {
-    return undefined;
+    return {};
   }
 
   for (const url of release.sources) {
-- 
GitLab