mirror of
https://github.com/renovatebot/renovate.git
synced 2026-10-31 17:51:49 +00:00
be13c9f5f7
* 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.
128 lines
4.0 KiB
TypeScript
128 lines
4.0 KiB
TypeScript
import { Fixtures } from '~test/fixtures.ts';
|
|
import { extractPackageFile } from './index.ts';
|
|
|
|
const multiDepFile = Fixtures.get('validHelmsfile.yaml');
|
|
const otherYamlFile = Fixtures.get('empty.yaml');
|
|
|
|
describe('modules/manager/helmsman/extract', () => {
|
|
describe('extractPackageFile()', () => {
|
|
it('returns null if empty', () => {
|
|
const content = ``;
|
|
const fileName = 'desired_state.yaml';
|
|
const result = extractPackageFile(content, fileName, {});
|
|
expect(result).toBeNull();
|
|
});
|
|
|
|
it('returns null if extracting non helmsman yaml file', () => {
|
|
const content = otherYamlFile;
|
|
const fileName = 'requirements.yaml';
|
|
const result = extractPackageFile(content, fileName, {});
|
|
expect(result).toBeNull();
|
|
});
|
|
|
|
it('returns null if apps not defined', () => {
|
|
const fileName = 'incorrect.yaml';
|
|
const result = extractPackageFile('incorrect', fileName, {});
|
|
expect(result).toBeNull();
|
|
});
|
|
|
|
it('resolves registryAliases for OCI charts', () => {
|
|
const result = extractPackageFile(multiDepFile, 'helmsman.yaml', {
|
|
registryAliases: { 'ghcr.io': 'ghcr.proxy.test' },
|
|
});
|
|
expect(result?.deps).toContainEqual({
|
|
currentValue: '6.4.0',
|
|
datasource: 'docker',
|
|
depName: 'podinfo',
|
|
packageName: 'ghcr.proxy.test/stefanprodan/charts/podinfo',
|
|
pinDigests: false,
|
|
});
|
|
});
|
|
|
|
it('extract deps', () => {
|
|
const fileName = 'helmsman.yaml';
|
|
const result = extractPackageFile(multiDepFile, fileName, {});
|
|
expect(result).toEqual({
|
|
deps: [
|
|
{
|
|
currentValue: '19.0.3',
|
|
datasource: 'helm',
|
|
depName: 'kube-prometheus',
|
|
packageName: 'kube-prometheus-stack',
|
|
registryUrls: [
|
|
'https://prometheus-community.github.io/helm-charts',
|
|
],
|
|
},
|
|
{
|
|
currentValue: '2.6.0',
|
|
datasource: 'helm',
|
|
depName: 'loki',
|
|
packageName: 'loki',
|
|
registryUrls: ['https://grafana.github.io/helm-charts'],
|
|
},
|
|
{
|
|
currentValue: '0.7.7',
|
|
datasource: 'helm',
|
|
depName: 'tempo',
|
|
packageName: 'tempo',
|
|
registryUrls: ['https://grafana.github.io/helm-charts'],
|
|
},
|
|
{
|
|
currentValue: '0.6.0',
|
|
datasource: 'helm',
|
|
depName: 'otlp-collector',
|
|
packageName: 'opentelemetry-collector',
|
|
registryUrls: [
|
|
'https://open-telemetry.github.io/opentelemetry-helm-charts',
|
|
],
|
|
},
|
|
{
|
|
currentValue: '0.25.0',
|
|
datasource: 'helm',
|
|
depName: 'strimzi-operator',
|
|
packageName: 'strimzi-kafka-operator',
|
|
registryUrls: ['https://strimzi.io/charts/'],
|
|
},
|
|
{
|
|
currentValue: '6.4.0',
|
|
datasource: 'docker',
|
|
depName: 'podinfo',
|
|
packageName: 'ghcr.io/stefanprodan/charts/podinfo',
|
|
pinDigests: false,
|
|
},
|
|
{
|
|
datasource: 'helm',
|
|
depName: 'strimzi-operator-missing-version',
|
|
skipReason: 'unspecified-version',
|
|
},
|
|
{
|
|
currentValue: '2.6.0',
|
|
datasource: 'helm',
|
|
depName: 'loki-no-registry-ref',
|
|
packageName: 'loki',
|
|
skipReason: 'no-repository',
|
|
},
|
|
{
|
|
currentValue: '0.7.7',
|
|
datasource: 'helm',
|
|
depName: 'tempo-no-registry-ref',
|
|
skipReason: 'invalid-url',
|
|
},
|
|
{
|
|
currentValue: '19.0.3',
|
|
datasource: 'helm',
|
|
depName: 'kube-prometheus-no-lookup-name',
|
|
skipReason: 'invalid-name',
|
|
},
|
|
{
|
|
currentValue: '0.6.0',
|
|
datasource: 'helm',
|
|
depName: 'otlp-collector-no-chart',
|
|
skipReason: 'invalid-url',
|
|
},
|
|
],
|
|
});
|
|
});
|
|
});
|
|
});
|