diff --git a/lib/modules/manager/kustomize/__fixtures__/kustomizeHelmChart.yaml b/lib/modules/manager/kustomize/__fixtures__/kustomizeHelmChart.yaml index 56f4887e4ac969..1995c95721ff2d 100644 --- a/lib/modules/manager/kustomize/__fixtures__/kustomizeHelmChart.yaml +++ b/lib/modules/manager/kustomize/__fixtures__/kustomizeHelmChart.yaml @@ -13,3 +13,7 @@ helmCharts: releaseName: moria version: 3.1.3 repo: https://itzg.github.io/minecraft-server-charts +- name: redis + releaseName: redis + version: 18.12.1 + repo: oci://registry-1.docker.io/bitnamicharts diff --git a/lib/modules/manager/kustomize/__snapshots__/extract.spec.ts.snap b/lib/modules/manager/kustomize/__snapshots__/extract.spec.ts.snap index 2d21234e895c42..210d7ccf638dd8 100644 --- a/lib/modules/manager/kustomize/__snapshots__/extract.spec.ts.snap +++ b/lib/modules/manager/kustomize/__snapshots__/extract.spec.ts.snap @@ -174,6 +174,15 @@ exports[`modules/manager/kustomize/extract extractPackageFile() parses helmChart "https://itzg.github.io/minecraft-server-charts", ], }, + { + "currentDigest": undefined, + "currentValue": "18.12.1", + "datasource": "docker", + "depName": "redis", + "depType": "HelmChart", + "packageName": "registry-1.docker.io/bitnamicharts/redis", + "pinDigests": false, + }, ], } `; diff --git a/lib/modules/manager/kustomize/extract.spec.ts b/lib/modules/manager/kustomize/extract.spec.ts index 808e9a09017595..f6f2f67ac613b4 100644 --- a/lib/modules/manager/kustomize/extract.spec.ts +++ b/lib/modules/manager/kustomize/extract.spec.ts @@ -175,6 +175,22 @@ describe('modules/manager/kustomize/extract', () => { }); expect(pkg).toEqual(sample); }); + + it('should correctly extract an OCI chart', () => { + const sample = { + depName: 'redis', + packageName: 'registry-1.docker.io/bitnamicharts/redis', + currentValue: '18.12.1', + datasource: DockerDatasource.id, + pinDigests: false, + }; + const pkg = extractHelmChart({ + name: sample.depName, + version: sample.currentValue, + repo: 'oci://registry-1.docker.io/bitnamicharts', + }); + expect(pkg).toEqual(sample); + }); }); describe('image extraction', () => { @@ -501,8 +517,17 @@ describe('modules/manager/kustomize/extract', () => { depType: 'HelmChart', depName: 'minecraft', currentValue: '3.1.3', + datasource: HelmDatasource.id, registryUrls: ['https://itzg.github.io/minecraft-server-charts'], }, + { + depType: 'HelmChart', + depName: 'redis', + currentValue: '18.12.1', + datasource: DockerDatasource.id, + packageName: 'registry-1.docker.io/bitnamicharts/redis', + pinDigests: false, + }, ], }); }); diff --git a/lib/modules/manager/kustomize/extract.ts b/lib/modules/manager/kustomize/extract.ts index b999bc0ef368cd..6ffc65a5e977bd 100644 --- a/lib/modules/manager/kustomize/extract.ts +++ b/lib/modules/manager/kustomize/extract.ts @@ -7,6 +7,7 @@ import { GitTagsDatasource } from '../../datasource/git-tags'; import { GithubTagsDatasource } from '../../datasource/github-tags'; import { HelmDatasource } from '../../datasource/helm'; import { getDep } from '../dockerfile/extract'; +import { isOCIRegistry } from '../helmv3/utils'; import type { ExtractConfig, PackageDependency, @@ -140,11 +141,28 @@ export function extractImage( export function extractHelmChart( helmChart: HelmChart, + aliases?: Record | undefined, ): PackageDependency | null { if (!helmChart.name) { return null; } + if (isOCIRegistry(helmChart.repo)) { + const dep = getDep( + `${helmChart.repo.replace('oci://', '')}/${helmChart.name}:${helmChart.version}`, + false, + aliases, + ); + return { + ...dep, + depName: helmChart.name, + packageName: dep.depName, + // https://github.com/helm/helm/issues/10312 + // https://github.com/helm/helm/issues/10678 + pinDigests: false, + }; + } + return { depName: helmChart.name, currentValue: helmChart.version, @@ -238,7 +256,7 @@ export function extractPackageFile( // grab the helm charts for (const helmChart of coerceArray(pkg.helmCharts)) { - const dep = extractHelmChart(helmChart); + const dep = extractHelmChart(helmChart, config.registryAliases); if (dep) { deps.push({ ...dep, diff --git a/lib/modules/manager/kustomize/readme.md b/lib/modules/manager/kustomize/readme.md index ed665229dc393d..a5593b4a7f3a19 100644 --- a/lib/modules/manager/kustomize/readme.md +++ b/lib/modules/manager/kustomize/readme.md @@ -18,6 +18,7 @@ This manager uses three `depType`s to allow fine-grained control of which depend - Component - Kustomization - HelmChart +- OCIChart **Limitations**