Files
renovate/lib/modules/manager/vendir/extract.spec.ts
Sebastian Poxhofer be13c9f5f7 feat(manager): share OCI Helm chart resolution across managers (#45760)
* feat(manager): share OCI Helm chart resolution across managers

Add getOciChartDep() to helmv3/oci.ts and use it in argocd, fleet, flux,
helmfile, helmsman, helmv3, kustomize, sveltos, terraform and vendir.

- set pinDigests: false for OCI charts in all of them
- apply registryAliases to OCI charts in argocd, helmfile and helmsman
- keep the registry port in terraform helm_release repositories
- skip fleet OCI charts without a version instead of using 'undefined'

* docs(manager/helmv3): correct the OCI chart pinDigests rationale

* refactor(manager/helmfile): drop redundant OCI repository url guard

The repository schema already requires url to be a string, so the falsy
branch could not be reached by parsed input and left the patch partially
covered.
2026-09-09 13:51:30 +00:00

99 lines
3.2 KiB
TypeScript

import { codeBlock } from 'common-tags';
import { Fixtures } from '~test/fixtures.ts';
import { extractPackageFile } from './index.ts';
const validContents = Fixtures.get('valid-contents.yaml');
const invalidContents = Fixtures.get('invalid-contents.yaml');
describe('modules/manager/vendir/extract', () => {
describe('extractPackageFile()', () => {
it('returns null for invalid yaml file content', () => {
const result = extractPackageFile('nothing here: [', 'vendir.yml', {});
expect(result).toBeNull();
});
it('returns null for empty yaml file content', () => {
const result = extractPackageFile('', 'vendir.yml', {});
expect(result).toBeNull();
});
it('returns null for empty directories key', () => {
const emptyDirectories = codeBlock`
apiVersion: vendir.k14s.io/v1alpha1
kind: Config
directories: []
`;
const result = extractPackageFile(emptyDirectories, 'vendir.yml', {});
expect(result).toBeNull();
});
it('returns null for nonHelmChart key', () => {
const result = extractPackageFile(invalidContents, 'vendir.yml', {});
expect(result).toBeNull();
});
it('multiple charts - extracts helm-chart from vendir.yml correctly', () => {
const result = extractPackageFile(validContents, 'vendir.yml', {
registryAliases: {
test: 'quay.example.com/organization',
},
});
expect(result).toMatchObject({
deps: [
{
currentValue: '7.10.1',
depName: 'valid-helmchart-1',
datasource: 'helm',
depType: 'HelmChart',
registryUrls: ['https://charts.bitnami.com/bitnami'],
},
{
currentValue: '7.10.1',
depName: 'valid-helmchart-2',
datasource: 'helm',
depType: 'HelmChart',
registryUrls: ['https://charts.bitnami.com/bitnami'],
},
{
currentValue: '7.10.1',
depName: 'oci-chart',
datasource: 'docker',
depType: 'HelmChart',
packageName: 'charts.bitnami.com/bitnami/oci-chart',
pinDigests: false,
},
{
currentValue: '7.10.1',
depName: 'aliased-oci-chart',
datasource: 'docker',
depType: 'HelmChart',
packageName: 'quay.example.com/organization/aliased-oci-chart',
pinDigests: false,
},
{
currentValue: '7.10.1',
depName: 'https://github.com/test/test',
depType: 'GitSource',
datasource: 'git-refs',
},
{
currentValue: '7.10.1',
depName: 'test/test',
packageName: 'test/test',
datasource: 'github-releases',
},
{
currentValue: 'latest',
packageName:
'https://raw.githubusercontent.com/mend/renovate-ce-ee/refs/heads/main/docs/openapi-community.yaml',
depType: 'HttpSource',
skipReason: 'unsupported-datasource',
},
],
});
// git-refs datasource does not support custom registries
expect(result?.deps[4].registryUrls).toBeUndefined();
});
});
});