From 3fabb3b50b66a1dabdc7f1f34ba4c73fef13a571 Mon Sep 17 00:00:00 2001
From: Rhys Arkins <rhys@arkins.net>
Date: Tue, 14 Dec 2021 18:43:18 +0100
Subject: [PATCH] refactor(helm): repository -> helmRepository (#13109)

---
 lib/datasource/helm/index.ts | 27 +++++++++++++++++++--------
 lib/datasource/helm/types.ts |  2 +-
 2 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/lib/datasource/helm/index.ts b/lib/datasource/helm/index.ts
index 83dd7667df..9eb5bf40f8 100644
--- a/lib/datasource/helm/index.ts
+++ b/lib/datasource/helm/index.ts
@@ -7,7 +7,7 @@ import * as helmVersioning from '../../versioning/helm';
 import { Datasource } from '../datasource';
 import type { GetReleasesConfig, ReleaseResult } from '../types';
 import { findSourceUrl } from './common';
-import type { HelmRepository, RepositoryData } from './types';
+import type { HelmRepository, HelmRepositoryData } from './types';
 
 export class HelmDatasource extends Datasource {
   static readonly id = 'helm';
@@ -29,16 +29,21 @@ export class HelmDatasource extends Datasource {
 
   @cache({
     namespace: `datasource-${HelmDatasource.id}`,
-    key: (repository: string) => repository,
+    key: (helmRepository: string) => helmRepository,
   })
-  async getRepositoryData(repository: string): Promise<RepositoryData | null> {
+  async getRepositoryData(
+    helmRepository: string
+  ): Promise<HelmRepositoryData | null> {
     let res: any;
     try {
       res = await this.http.get('index.yaml', {
-        baseUrl: ensureTrailingSlash(repository),
+        baseUrl: ensureTrailingSlash(helmRepository),
       });
       if (!res || !res.body) {
-        logger.warn(`Received invalid response from ${repository}`);
+        logger.warn(
+          { helmRepository },
+          `Received invalid response from helm repository`
+        );
         return null;
       }
     } catch (err) {
@@ -49,10 +54,13 @@ export class HelmDatasource extends Datasource {
         json: true,
       }) as HelmRepository;
       if (!is.plainObject<HelmRepository>(doc)) {
-        logger.warn(`Failed to parse index.yaml from ${repository}`);
+        logger.warn(
+          { helmRepository },
+          `Failed to parse index.yaml from helm repository`
+        );
         return null;
       }
-      const result: RepositoryData = {};
+      const result: HelmRepositoryData = {};
       for (const [name, releases] of Object.entries(doc.entries)) {
         const { sourceUrl, sourceDirectory } = findSourceUrl(releases[0]);
         result[name] = {
@@ -68,7 +76,10 @@ export class HelmDatasource extends Datasource {
 
       return result;
     } catch (err) {
-      logger.warn(`Failed to parse index.yaml from ${repository}`);
+      logger.warn(
+        { helmRepository },
+        `Failed to parse index.yaml from helm repository`
+      );
       logger.debug(err);
       return null;
     }
diff --git a/lib/datasource/helm/types.ts b/lib/datasource/helm/types.ts
index ccfc418c13..8f37b3a385 100644
--- a/lib/datasource/helm/types.ts
+++ b/lib/datasource/helm/types.ts
@@ -12,7 +12,7 @@ export interface HelmRepository {
   entries: Record<string, HelmRelease[]>;
 }
 
-export type RepositoryData = Record<string, ReleaseResult>;
+export type HelmRepositoryData = Record<string, ReleaseResult>;
 
 export interface RepoSource {
   sourceUrl?: string;
-- 
GitLab