Skip to content

Commit

Permalink
fix(manager/flux): skip local charts
Browse files Browse the repository at this point in the history
  • Loading branch information
viceice committed Nov 5, 2024
1 parent 85267b9 commit f49dd65
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
28 changes: 28 additions & 0 deletions lib/modules/manager/flux/extract.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,34 @@ describe('modules/manager/flux/extract', () => {
expect(result).toBeNull();
});

it('skip HelmRelease with local chart', () => {
const result = extractPackageFile(
codeBlock`
apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
name: cert-manager-config
namespace: kube-system
spec:
chart:
spec:
chart: ./charts/cert-manager-config
sourceRef:
kind: GitRepository
name: chart-repo
`,
'test.yaml',
);
expect(result).toEqual({
deps: [
{
depName: './charts/cert-manager-config',
skipReason: 'local-chart',
},
],
});
});

it('does not match HelmRelease resources without a namespace to HelmRepository resources without a namespace', () => {
const result = extractPackageFile(
codeBlock`
Expand Down
10 changes: 9 additions & 1 deletion lib/modules/manager/flux/extract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,20 @@ function resolveResourceManifest(
for (const resource of manifest.resources) {
switch (resource.kind) {
case 'HelmRelease': {
const depName = resource.spec.chart.spec.chart;
const dep: PackageDependency = {
depName: resource.spec.chart.spec.chart,
depName,
currentValue: resource.spec.chart.spec.version,
datasource: HelmDatasource.id,
};

if (depName.startsWith('./')) {
dep.skipReason = 'local-chart';
delete dep.datasource;
deps.push(dep);
continue;
}

const matchingRepositories = helmRepositories.filter(
(rep) =>
rep.kind === resource.spec.chart.spec.sourceRef?.kind &&
Expand Down

0 comments on commit f49dd65

Please sign in to comment.