Skip to content

Commit

Permalink
fix(helmfile): url joiner is broken, use upath instead (#31008)
Browse files Browse the repository at this point in the history
Co-authored-by: Michael Kriese <[email protected]>
  • Loading branch information
PhilipAbed and viceice committed Aug 27, 2024
1 parent 446f6fc commit ad64f11
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
27 changes: 27 additions & 0 deletions lib/modules/manager/helmfile/extract.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -483,5 +483,32 @@ describe('modules/manager/helmfile/extract', () => {
managerData: { needKustomize: true },
});
});

it('makes sure url joiner works correctly', async () => {
const content = codeBlock`
releases:
- name: argocd
version: 0.4.2
chart: oci://gitlab.example.com:5000/group/subgroup
`;
const fileName = 'helmfile.yaml';
const result = await extractPackageFile(content, fileName, {
registryAliases: {
stable: 'https://charts.helm.sh/stable',
},
});
expect(result).toMatchObject({
datasource: 'helm',
deps: [
{
currentValue: '0.4.2',
datasource: 'docker',
depName: 'subgroup',
packageName: 'gitlab.example.com:5000/group/subgroup',
registryUrls: [],
},
],
});
});
});
});
5 changes: 2 additions & 3 deletions lib/modules/manager/helmfile/extract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import is from '@sindresorhus/is';
import { logger } from '../../../logger';
import { coerceArray } from '../../../util/array';
import { regEx } from '../../../util/regex';
import { joinUrlParts } from '../../../util/url';
import { parseYaml } from '../../../util/yaml';
import { DockerDatasource } from '../../datasource/docker';
import { HelmDatasource } from '../../datasource/helm';
Expand Down Expand Up @@ -118,12 +117,12 @@ export async function extractPackageFile(

if (isOCIRegistry(dep.chart)) {
res.datasource = DockerDatasource.id;
res.packageName = joinUrlParts(repoName, depName);
res.packageName = `${repoName}/${depName}`;
} else if (registryData[repoName]?.oci) {
res.datasource = DockerDatasource.id;
const alias = registryData[repoName]?.url;
if (alias) {
res.packageName = joinUrlParts(alias, depName);
res.packageName = `${alias}/${depName}`;
}
}

Expand Down

0 comments on commit ad64f11

Please sign in to comment.