Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(manager/flux): skip local charts #32335

Merged
merged 1 commit into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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