diff options
author | Vladimir Kuznichenkov <[email protected]> | 2024-12-22 12:14:53 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2024-12-22 10:14:53 +0000 |
commit | 54e718e671e4e6e358ac982710716b89ad345759 (patch) | |
tree | d8a6213ea09167e1bf3960d2cd28840690780ddc | |
parent | f1a9b2425c877bc0d78a5fde7cc9b555923bcefc (diff) | |
download | renovate-54e718e671e4e6e358ac982710716b89ad345759.tar.gz renovate-54e718e671e4e6e358ac982710716b89ad345759.zip |
feat(manager/helmfile): allow forward slashes in OCI chart names (#33162)
-rw-r--r-- | lib/modules/manager/helmfile/extract.spec.ts | 26 | ||||
-rw-r--r-- | lib/modules/manager/helmfile/extract.ts | 16 |
2 files changed, 39 insertions, 3 deletions
diff --git a/lib/modules/manager/helmfile/extract.spec.ts b/lib/modules/manager/helmfile/extract.spec.ts index 9ce660515e7..9c36f13f5f9 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 eaff3133dee..5b11c9b0edc 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'; } |