diff --git a/lib/modules/manager/helmfile/extract.spec.ts b/lib/modules/manager/helmfile/extract.spec.ts index 9ce660515e782f14a90bd9edf4982855643f9065..9c36f13f5f91d588e417e8d0df3d90c01c409151 100644 --- a/lib/modules/manager/helmfile/extract.spec.ts +++ b/lib/modules/manager/helmfile/extract.spec.ts @@ -363,6 +363,32 @@ describe('modules/manager/helmfile/extract', () => { }); }); + it('allows OCI chart names containing forward slashes', async () => { + const content = ` + repositories: + - name: oci-repo + url: ghcr.io/example/oci-repo + oci: true + releases: + - name: nested-example + version: 1.2.3 + chart: oci-repo/nested/path/chart + `; + const fileName = 'helmfile.yaml'; + const result = await extractPackageFile(content, fileName, {}); + expect(result).toMatchObject({ + datasource: 'helm', + deps: [ + { + currentValue: '1.2.3', + depName: 'nested/path/chart', + datasource: 'docker', + packageName: 'ghcr.io/example/oci-repo/nested/path/chart', + }, + ], + }); + }); + it('parses a chart with an oci repository with ---', async () => { const content = codeBlock` repositories: diff --git a/lib/modules/manager/helmfile/extract.ts b/lib/modules/manager/helmfile/extract.ts index eaff3133deee3ba7ea9f4ad96b883985df66d6a4..5b11c9b0edc5a8eee9615a78c183c881c7202bd7 100644 --- a/lib/modules/manager/helmfile/extract.ts +++ b/lib/modules/manager/helmfile/extract.ts @@ -18,8 +18,13 @@ import { localChartHasKustomizationsYaml, } from './utils'; -const isValidChartName = (name: string | undefined): boolean => - !!name && !regEx(/[!@#$%^&*(),.?":{}/|<>A-Z]/).test(name); +function isValidChartName(name: string | undefined, oci: boolean): boolean { + if (oci) { + return !!name && !regEx(/[!@#$%^&*(),.?":{}|<>A-Z]/).test(name); + } else { + return !!name && !regEx(/[!@#$%^&*(),.?":{}/|<>A-Z]/).test(name); + } +} function isLocalPath(possiblePath: string): boolean { return ['./', '../', '/'].some((localPrefix) => @@ -118,7 +123,12 @@ export async function extractPackageFile( // By definition on helm the chart name should be lowercase letter + number + - // However helmfile support templating of that field - if (!isValidChartName(res.depName)) { + if ( + !isValidChartName( + res.depName, + isOCIRegistry(dep.chart) || (registryData[repoName]?.oci ?? false), + ) + ) { res.skipReason = 'unsupported-chart-type'; }