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

feat(manager/flux): support chartRef in HelmRelease resources #31962

Open
wants to merge 187 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
187 commits
Select commit Hold shift + click to select a range
d3f0bcd
feat(manager/flux): support chartRef in HelmRelease resources
ssams Oct 15, 2024
dd7a0fa
feat(manager/flux): update documentation for chartRef
ssams Oct 15, 2024
0016350
feat(manager/flux): refactor to resolve review comments
ssams Oct 16, 2024
d3a0ddc
Merge branch 'main' into feat/flux-chartref
ssams Nov 5, 2024
7b968c0
feat(manager/flux): apply review comments - add logging and reuse tes…
ssams Nov 5, 2024
3cbb614
Merge branch 'main' into feat/flux-chartref
ssams Nov 5, 2024
950a118
Merge remote-tracking branch 'upstream/main' into feat/flux-chartref
ssams Nov 5, 2024
f435397
Merge branch 'main' into feat/flux-chartref
ssams Nov 5, 2024
05e507a
Merge branch 'main' into feat/flux-chartref
rarkins Nov 6, 2024
84dd9ce
Merge branch 'main' into feat/flux-chartref
ssams Nov 6, 2024
a09c677
Merge branch 'main' into feat/flux-chartref
ssams Nov 14, 2024
952ab86
fix(deps): update ghcr.io/renovatebot/base-image docker tag to v9.7.4…
renovate[bot] Nov 14, 2024
8703a11
feat(manager/cargo): support reading package version from workspace (…
viceice Nov 14, 2024
9a1431c
build(deps): update dependency openpgp to v6 (#32479)
renovate[bot] Nov 14, 2024
2c2fc61
build(deps): update opentelemetry-js monorepo to v0.54.2 (#32538)
renovate[bot] Nov 14, 2024
be8deab
docs(gradle): correct requirements to process verification-metadata (…
jamietanna Nov 14, 2024
e86a491
chore(deps): update github/codeql-action action to v3.27.4 (#32541)
renovate[bot] Nov 14, 2024
a4c5c3d
docs: release notes for Renovate v39 (#32504)
HonkingGoose Nov 14, 2024
4a59916
fix(deps): update ghcr.io/renovatebot/base-image docker tag to v9.7.5…
renovate[bot] Nov 14, 2024
16e70a8
chore(deps): update slackapi/slack-github-action action to v1.27.1 (#…
renovate[bot] Nov 14, 2024
e77948d
chore(deps): update python:3.13 docker digest to bc78d3c (#32553)
renovate[bot] Nov 14, 2024
054f0a3
fix(deps): update ghcr.io/renovatebot/base-image docker tag to v9.7.6…
renovate[bot] Nov 15, 2024
e1993a1
feat(datasource/go): support gitea tags (#32555)
viceice Nov 15, 2024
77d9982
chore(manager/gomod): Update go toolchain specifier in test (#32546)
echarrod Nov 15, 2024
cefa324
feat(bundler): add source variables support (#32337)
Djiit Nov 15, 2024
30c097e
fix(logs): don't log all packageFiles when checking for deprecated (#…
rarkins Nov 15, 2024
d5757aa
feat(manager/conan): Conan 1 package name compatibility (#32425)
caseyduquettesc Nov 16, 2024
adcccde
fix: Handle `extractVersion` with release post-processing (#32540)
zharinov Nov 16, 2024
7384c69
fix(git): fix gpg commit signing (#32483) (#32543)
bpfoster Nov 16, 2024
d18857c
fix: ensure packageFiles isn't null during dependency extraction (#32…
Churro Nov 16, 2024
278e959
chore(deps): update dependency renovatebot/github-action to v41.0.3 (…
renovate[bot] Nov 16, 2024
79ad88d
chore(deps): update dependency markdownlint-cli2 to v0.15.0 (#32574)
renovate[bot] Nov 17, 2024
5067427
chore(deps): update dependency nock to v13.5.6 (#32571)
renovate[bot] Nov 17, 2024
670fd4d
chore(deps): update ghcr.io/containerbase/devcontainer docker tag to …
renovate[bot] Nov 17, 2024
7367028
fix(deps): update ghcr.io/containerbase/sidecar docker tag to v13.0.1…
renovate[bot] Nov 17, 2024
779306d
fix(deps): update ghcr.io/containerbase/sidecar docker tag to v13.0.1…
renovate[bot] Nov 17, 2024
98cddde
chore(deps): update ghcr.io/containerbase/devcontainer docker tag to …
renovate[bot] Nov 17, 2024
3c5d3a6
chore(deps): lock file maintenance (#32579)
renovate[bot] Nov 17, 2024
d3c795e
feat(uv): support GCloud credentials for Google Artifact Registry whe…
maxbrunet Nov 17, 2024
a4f1318
chore(deps): update ghcr.io/containerbase/devcontainer docker tag to …
renovate[bot] Nov 17, 2024
8d3414b
chore(deps): update containerbase/internal-tools action to v3.4.43 (#…
renovate[bot] Nov 17, 2024
3e0194b
chore(deps): update ghcr.io/containerbase/devcontainer docker tag to …
renovate[bot] Nov 17, 2024
d9e755b
fix(deps): update ghcr.io/containerbase/sidecar docker tag to v13.0.2…
renovate[bot] Nov 17, 2024
1efce64
fix(deps): update ghcr.io/renovatebot/base-image docker tag to v9.7.1…
renovate[bot] Nov 17, 2024
a066ee8
docs: update references to renovate/renovate (#32587)
renovate[bot] Nov 18, 2024
1be5e2c
chore(deps): lock file maintenance (#32588)
renovate[bot] Nov 18, 2024
a66cc22
chore(deps): update containerbase/internal-tools action to v3.4.45 (#…
renovate[bot] Nov 18, 2024
4cf4f30
chore(deps): update dependency @swc/core to v1.9.2 (#32590)
renovate[bot] Nov 18, 2024
a6751e1
feat(manager/asdf): add supported tools (#32333)
mtweeman Nov 18, 2024
ad70379
fix(terraform): correct hostname regex and add tests (#32565)
Jellyfrog Nov 18, 2024
14a7705
build(deps): update dependency @cdktf/hcl2json to v0.20.10 (#32593)
renovate[bot] Nov 18, 2024
47db4bd
fix(deps): update ghcr.io/renovatebot/base-image docker tag to v9.7.1…
renovate[bot] Nov 18, 2024
beebb50
chore(deps): update ghcr.io/containerbase/devcontainer docker tag to …
renovate[bot] Nov 18, 2024
a042d01
fix(deps): update ghcr.io/containerbase/sidecar docker tag to v13.0.2…
renovate[bot] Nov 18, 2024
eb64ad0
docs(rust): hostType should be "crate" instead of "cargo" (#32591)
i10416 Nov 18, 2024
f1d113c
fix(docker-image): ensure base & cache dir at build time (#32594)
Gabriel-Ladzaretti Nov 19, 2024
a972677
chore(deps): lock file maintenance (#32618)
renovate[bot] Nov 19, 2024
a238e99
build(deps): update dependency @renovatebot/kbpgp to v4.0.1 (#32619)
renovate[bot] Nov 19, 2024
37a3b91
docs: add documentation for the Developer Portal host rules credentia…
justo-mend Nov 19, 2024
1c99990
docs(config-presets): use inline code for preset patterns (#32622)
risu729 Nov 19, 2024
b5aa712
chore(deps): update otel/opentelemetry-collector-contrib docker tag t…
renovate[bot] Nov 19, 2024
18f1722
fix(deps): update ghcr.io/renovatebot/base-image docker tag to v9.7.1…
renovate[bot] Nov 19, 2024
81921cd
feat(bundler): add inline source support (#32600)
Djiit Nov 20, 2024
011aecd
chore(deps): update aquasecurity/trivy-action action to v0.29.0 (#32628)
renovate[bot] Nov 20, 2024
b3e1940
build(deps): update dependency graph-data-structure to v4 (#32320)
renovate[bot] Nov 20, 2024
d6ff120
fix(deps): update dependency mkdocs-material to v9.5.45 (#32631)
renovate[bot] Nov 20, 2024
c8d7538
docs: updated encrypted secrets deprecation messaging (#32634)
justo-mend Nov 20, 2024
5f2636a
chore(deps): update pnpm to v9.13.0 (#32637)
renovate[bot] Nov 20, 2024
36935bf
chore(deps): update github/codeql-action action to v3.27.5 (#32641)
renovate[bot] Nov 20, 2024
1a51169
feat(deps): update ghcr.io/renovatebot/base-image docker tag to v9.8.…
renovate[bot] Nov 20, 2024
fd60bd3
feat(deps): update ghcr.io/renovatebot/base-image docker tag to v9.9.…
renovate[bot] Nov 20, 2024
aeb14d5
fix(deps): update ghcr.io/renovatebot/base-image docker tag to v9.9.2…
renovate[bot] Nov 21, 2024
83f9f80
chore(deps): update actions/dependency-review-action action to v4.5.0…
renovate[bot] Nov 21, 2024
be8f0d2
fix(docker): chmod the renovate cache dir to allow custom uids (#32649)
Gabriel-Ladzaretti Nov 21, 2024
7439b41
feat(gradle): add support for `java.toolchain.languageVersion` detect…
Churro Nov 21, 2024
f063edb
refactor(platform/gitlab): consolidate duplicate code (#32566)
RahulGautamSingh Nov 21, 2024
1605cce
feat(manager): Cloud Native Buildpacks project descriptor manager (#3…
pbusko Nov 21, 2024
1e0f7c5
fix(deps): update ghcr.io/renovatebot/base-image docker tag to v9.9.3…
renovate[bot] Nov 21, 2024
c7afaad
fix: Revert "feat(manager/asdf): add support for java semeru and seme…
MPV Nov 21, 2024
38636ce
fix(datasource/maven): make cache key extractedVersion specific (#32658)
Shegox Nov 21, 2024
b889b78
chore(deps): update pnpm to v9.13.1 (#32663)
renovate[bot] Nov 21, 2024
fe5fe11
fix(deps): update ghcr.io/renovatebot/base-image docker tag to v9.9.4…
renovate[bot] Nov 21, 2024
dcbb3fb
build(deps): update dependency google-auth-library to v9.15.0 (#32666)
renovate[bot] Nov 21, 2024
d6bab22
chore(deps): update pnpm to v9.13.2 (#32667)
renovate[bot] Nov 22, 2024
d762d67
feat(manager/asdf): add asdf protoc support (#32646)
ezzatron Nov 22, 2024
00bb5bd
fix(deps): update ghcr.io/renovatebot/base-image docker tag to v9.9.5…
renovate[bot] Nov 22, 2024
b428f03
chore(deps): update dependency type-fest to v4.27.0 (#32669)
renovate[bot] Nov 22, 2024
d98b5f7
refactor(platform/gitlab): fix api reponse type in `createPr` fn (#32…
RahulGautamSingh Nov 22, 2024
966ae9b
fix(bitbucket): source link root path (#32676)
setchy Nov 22, 2024
0eddb6a
fix: Revert "fix(bitbucket): source link root path" (#32680)
setchy Nov 22, 2024
d8950f1
fix(deps): update ghcr.io/renovatebot/base-image docker tag to v9.9.6…
renovate[bot] Nov 22, 2024
f816464
chore(deps): lock file maintenance (#32686)
renovate[bot] Nov 23, 2024
6d17df1
chore(deps): update codecov/codecov-action action to v5 (#32683)
renovate[bot] Nov 23, 2024
f4617d2
feat(deps): update ghcr.io/renovatebot/base-image docker tag to v9.10…
renovate[bot] Nov 24, 2024
41417c1
refactor(maven): Fix types for util functions (#32702)
zharinov Nov 24, 2024
5dfacdf
feat(bitbucket): support fetching changelogs with source directory (#…
setchy Nov 24, 2024
e6faac3
refactor: Error type narrowing for `Result` class (#32705)
zharinov Nov 24, 2024
8268201
chore(deps): update containerbase/internal-tools action to v3.4.47 (#…
renovate[bot] Nov 25, 2024
c4e3845
docs: update references to renovate/renovate (#32711)
renovate[bot] Nov 25, 2024
9044dee
chore(deps): update dependency pdm to v2.21.0 (#32712)
renovate[bot] Nov 25, 2024
8ac16c7
feat(datasource/cpan): populate latest tag (#32677)
RahulGautamSingh Nov 25, 2024
b425b08
chore(deps): update dependency renovatebot/github-action to v41.0.4 (…
renovate[bot] Nov 25, 2024
78627a9
fix(gitlab): ensure `getPrList()` runtime integrity (#32291)
RahulGautamSingh Nov 25, 2024
581bc6e
feat(schedule): use `croner` library to check schedule (#32573)
RahulGautamSingh Nov 25, 2024
58cd3fd
fix(deps): update dependency mkdocs-material to v9.5.46 (#32716)
renovate[bot] Nov 25, 2024
e354c7c
build(deps): update opentelemetry-js monorepo (#32717)
renovate[bot] Nov 25, 2024
4acee2d
feat(deps): update ghcr.io/renovatebot/base-image docker tag to v9.11…
renovate[bot] Nov 25, 2024
3e98779
feat(deps): update ghcr.io/renovatebot/base-image docker tag to v9.11…
renovate[bot] Nov 25, 2024
f975fac
chore(deps): update containerbase/internal-tools action to v3.5.0 (#3…
renovate[bot] Nov 25, 2024
55f1775
chore(deps): update dependency husky to v9.1.7 (#32725)
renovate[bot] Nov 25, 2024
5ec2225
build(deps): update dependency @opentelemetry/instrumentation-bunyan …
renovate[bot] Nov 25, 2024
adfef82
fix(deps): update ghcr.io/renovatebot/base-image docker tag to v9.11.…
renovate[bot] Nov 25, 2024
faf9d51
feat: convert `sourceDirectory` to a template eligible config (#32701)
setchy Nov 26, 2024
f0e01eb
docs(versioning/same-major): fix typo (#32732)
ITaluone Nov 26, 2024
9f1d957
chore(deps): update containerbase/internal-tools action to v3.5.1 (#3…
renovate[bot] Nov 26, 2024
27956d8
build(deps): update dependency @yarnpkg/core to v4.1.6 (#32736)
renovate[bot] Nov 26, 2024
28b18ba
build(deps): update dependency cacache to v19 (#32739)
renovate[bot] Nov 26, 2024
44a659e
build(deps): update dependency git-url-parse to v16 (#32741)
renovate[bot] Nov 26, 2024
440f274
build(deps): update dependency diff to v7 (#32740)
renovate[bot] Nov 26, 2024
46e70ae
fix(bitbucket): release notes heading link (#32693)
setchy Nov 26, 2024
ef6ea5c
chore(deps): update dependency @types/diff to v6 (#32742)
renovate[bot] Nov 26, 2024
4b189eb
build(deps): update dependency yaml to v2.6.1 (#32744)
renovate[bot] Nov 26, 2024
60975d4
fix(presets): Add F# to dotnet monorepo (#32706)
peterhirn Nov 26, 2024
9b12178
ci: disable Windows tests (#32754)
viceice Nov 26, 2024
45140d4
test(presets): validate schedule presets (#32755)
RahulGautamSingh Nov 26, 2024
1a1fc01
chore(deps): update dependency @types/better-sqlite3 to v7.6.12 (#32756)
renovate[bot] Nov 26, 2024
41d2162
chore(deps): update containerbase/internal-tools action to v3.5.2 (#3…
renovate[bot] Nov 26, 2024
3901732
chore(deps): update davidanson/markdownlint-cli2-action action to v18…
renovate[bot] Nov 26, 2024
bf52f35
chore(deps): update ghcr.io/containerbase/devcontainer docker tag to …
renovate[bot] Nov 26, 2024
651f7e6
fix(deps): update ghcr.io/containerbase/sidecar docker tag to v13.0.2…
renovate[bot] Nov 27, 2024
c98c004
chore(deps): update pnpm to v9.14.1 (#32762)
renovate[bot] Nov 27, 2024
cf66776
fix(deps): update ghcr.io/renovatebot/base-image docker tag to v9.11.…
renovate[bot] Nov 27, 2024
8ea3236
chore(deps): update docker/dockerfile docker tag to v1.12.0 (#32764)
renovate[bot] Nov 27, 2024
7858a9a
fix(bitbucket): source link root path (#32689)
setchy Nov 27, 2024
3a3094d
fix(npm): update npmrc before executing corepack cmd (#32733)
RahulGautamSingh Nov 27, 2024
f0bf80a
feat(datasource/pypi): always fallback to try simple endpoints (#32024)
rarkins Nov 27, 2024
d61d501
feat(manager/dockerfile): add support for Dockerfile `RUN --mount=fro…
bschoenmaeckers Nov 27, 2024
48ec83d
chore(deps): update pnpm to v9.14.2 (#32769)
renovate[bot] Nov 27, 2024
3c62680
fix(deps): update ghcr.io/renovatebot/base-image docker tag to v9.11.…
renovate[bot] Nov 27, 2024
9451311
build(deps): update dependency @opentelemetry/semantic-conventions to…
renovate[bot] Nov 27, 2024
d576dcf
chore(deps): update pdm-project/setup-pdm action to v4.2 (#32776)
renovate[bot] Nov 28, 2024
016d2f0
feat(schedule): replace `later` with `cron` (#32718)
RahulGautamSingh Nov 28, 2024
ca6af82
fix(manager/kustomize): fix parsing kustomize resource URLs with addi…
roosmaa Nov 28, 2024
a63a6e5
docs(versioning:regex): add ghcr.io/linuxserver/openssh-server exampl…
mbrodala Nov 28, 2024
912fc69
docs(versioning:regex): mention numeric capture group requirement (#3…
mbrodala Nov 28, 2024
fa71ccb
feat(maven): Remove unnecessary HTML page fetches (#32662)
zharinov Nov 28, 2024
f0488b7
feat(preset): Add elastic/ecs-dotnet monorepo group (#32780)
odin568 Nov 28, 2024
85951a5
refactor: Make `parseUrl` utility idempotent (#32792)
zharinov Nov 28, 2024
8c8eb48
build(deps): update dependency cronstrue to v2.52.0 (#32793)
renovate[bot] Nov 28, 2024
b14e392
refactor(maven): Use specific type for `getDependencyInfo` result (#3…
zharinov Nov 28, 2024
761fb6c
build(deps): update dependency openpgp to v6.0.1 (#32794)
renovate[bot] Nov 28, 2024
cc2dcf9
refactor: Rename `unwrapOrElse` to `unwrapOr` for `Result` utility (#…
zharinov Nov 28, 2024
67e557f
feat: Wrap callback returning Promise for `Result` utility (#32788)
zharinov Nov 28, 2024
179b415
feat(manager/flux): Allow OCI media type used by `flux push artifact`…
maboehm Nov 28, 2024
0645ee1
fix(manager/git-submodule): updates when update=none (#32455)
samgiz Nov 28, 2024
dfd939c
refactor(maven): Simplify metadata representation (#32786)
zharinov Nov 28, 2024
874d0c5
feat(github-action): retain spaces in extracted values (#32730)
JP-Ellis Nov 28, 2024
ecbe50d
test(config/options): detect duplicate options (#32795)
RahulGautamSingh Nov 29, 2024
c550ef4
feat(manager/pep621): add support for uv index configuration (#32771)
bschoenmaeckers Nov 29, 2024
009ff0f
chore(deps): update dependency @swc/core to v1.9.3 (#32796)
renovate[bot] Nov 29, 2024
afec946
feat(manager/mix): fix mix and git dependencies (#32708)
1oglop1 Nov 29, 2024
f994c42
feat(preset): Add axis2 monorepo group (#32772)
felipecrs Nov 29, 2024
8c35e3e
fix: updated url (#32801)
tim-goto Nov 29, 2024
a3204a2
chore(deps): update dependency typescript to v5.7.2 (#32811)
renovate[bot] Nov 29, 2024
3bd8241
chore(deps): update dependency renovatebot/github-action to v41.0.5 (…
renovate[bot] Nov 29, 2024
1f3078e
feat(gerrit): Reduce email notifications (#32817)
felipecrs Nov 30, 2024
4650862
chore(deps): update dependency @types/node to v20.17.7 (#32820)
renovate[bot] Nov 30, 2024
d3c4205
docs(gradle): add a section about Gradle plugin support (#32773)
tfkhim Nov 30, 2024
2098b0a
chore(deps): update ghcr.io/containerbase/devcontainer docker tag to …
renovate[bot] Nov 30, 2024
b627479
chore(deps): update dependency type-fest to v4.27.1 (#32823)
renovate[bot] Nov 30, 2024
e8b30bb
fix(gerrit): `getBranchStatus` not returning `red` for failed checks …
felipecrs Nov 30, 2024
1e64f80
feat(preset): Add Apache POI monorepo group (#32809)
felipecrs Nov 30, 2024
4aa7aa2
feat(preset): Add jetty monorepo group (#32808)
felipecrs Nov 30, 2024
77997cf
fix(docs): typo (#32821)
meysam81 Nov 30, 2024
81288a9
fix(deps): update ghcr.io/containerbase/sidecar docker tag to v13.0.2…
renovate[bot] Nov 30, 2024
91ac5db
fix(deps): update ghcr.io/renovatebot/base-image docker tag to v9.11.…
renovate[bot] Nov 30, 2024
767b557
build(deps): update aws-sdk-js-v3 monorepo (#32828)
renovate[bot] Dec 1, 2024
a797a72
docs(managers): add missing url and displayName (#32621)
risu729 Dec 1, 2024
d092f92
fix(deps): update dependency mkdocs-material to v9.5.47 (#32831)
renovate[bot] Dec 1, 2024
4c1bd9a
chore(deps): update dependency type-fest to v4.28.0 (#32832)
renovate[bot] Dec 1, 2024
ea419c3
chore(deps): update containerbase/internal-tools action to v3.5.4 (#3…
renovate[bot] Dec 2, 2024
e2729e3
docs: update references to renovate/renovate (#32838)
renovate[bot] Dec 2, 2024
721ae18
feat(lib/data): add Funogram monorepo (#32835)
ForNeVeR Dec 2, 2024
548ff3e
feat(manager/flux): manage HelmChart resource
ssams Dec 2, 2024
aaf1af2
Merge remote-tracking branch 'upstream/main' into feat/flux-chartref
ssams Dec 2, 2024
d5f35b4
Merge remote-tracking branch 'upstream/main' into feat/flux-chartref
ssams Dec 2, 2024
3358262
Merge branch 'main' into feat/flux-chartref
ssams Dec 9, 2024
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
14 changes: 14 additions & 0 deletions lib/modules/manager/flux/__fixtures__/helmChart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: source.toolkit.fluxcd.io/v1
ssams marked this conversation as resolved.
Show resolved Hide resolved
kind: HelmChart
metadata:
name: sealed-secrets
namespace: kube-system
spec:
interval: 10m
chart: sealed-secrets
sourceRef:
kind: HelmRepository
name: sealed-secrets
version: "2.0.2"
valuesFiles:
- values-prod.yaml
13 changes: 13 additions & 0 deletions lib/modules/manager/flux/__fixtures__/helmChartRefRelease.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: sealed-secrets
namespace: kube-system
spec:
interval: 10m
chartRef:
kind: HelmChart
name: sealed-secrets
namespace: kube-system
values:
replicaCount: 2
88 changes: 88 additions & 0 deletions lib/modules/manager/flux/common.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { regEx } from '../../../util/regex';
import { HelmDatasource } from '../../datasource/helm';
import type { PackageDependency } from '../types';
import type { HelmChart, HelmRelease, HelmRepository } from './schema';
import type { FluxManifest } from './types';

export const systemManifestFileNameRegex = '(?:^|/)gotk-components\\.ya?ml$';

Expand All @@ -8,3 +12,87 @@ export const systemManifestHeaderRegex =
export function isSystemManifest(file: string): boolean {
return regEx(systemManifestFileNameRegex).test(file);
}

export function resolveHelmReleaseManifest(
resource: HelmRelease,
helmRepositories: HelmRepository[],
helmCharts: HelmChart[],
): {
name: string;
dep: PackageDependency;
matchingRepositories: HelmRepository[];
} | null {
if (resource.spec.chartRef) {
viceice marked this conversation as resolved.
Show resolved Hide resolved
const chartRef = resource.spec.chartRef;
const helmChart = helmCharts.find(
(res) =>
res.kind === chartRef.kind &&
res.metadata.name === chartRef.name &&
res.metadata.namespace ===
(chartRef.namespace ?? resource.metadata?.namespace),
);
if (!helmChart) {
return null;
}
const chartName = helmChart.spec.chart;

const dep: PackageDependency = {
depName: chartName,
currentValue: helmChart.spec.version,
ssams marked this conversation as resolved.
Show resolved Hide resolved
datasource: HelmDatasource.id,
};

const matchingRepositories = helmRepositories.filter(
(rep) =>
rep.kind === helmChart.spec.sourceRef?.kind &&
rep.metadata.name === helmChart.spec.sourceRef.name &&
rep.metadata.namespace === helmChart.metadata?.namespace,
);
return { name: chartName, dep, matchingRepositories };
} else if (resource.spec.chart) {
const chartSpec = resource.spec.chart.spec;
const chartName = chartSpec.chart;

const dep: PackageDependency = {
depName: chartName,
currentValue: resource.spec.chart.spec.version,
datasource: HelmDatasource.id,
};

const matchingRepositories = helmRepositories.filter(
(rep) =>
rep.kind === chartSpec.sourceRef?.kind &&
rep.metadata.name === chartSpec.sourceRef.name &&
rep.metadata.namespace ===
(chartSpec.sourceRef.namespace ?? resource.metadata?.namespace),
);

return { name: chartName, dep, matchingRepositories };
} else {
return null;
}
}

export function collectHelmReposAndCharts(
manifests: FluxManifest[],
): [HelmRepository[], HelmChart[]] {
const helmRepositories: HelmRepository[] = [];
const helmCharts: HelmChart[] = [];

for (const manifest of manifests) {
if (manifest.kind === 'resource') {
for (const resource of manifest.resources) {
switch (resource.kind) {
case 'HelmRepository':
helmRepositories.push(resource);
break;
case 'HelmChart':
helmCharts.push(resource);
break;
}
}
}
}

return [helmRepositories, helmCharts];
}
131 changes: 131 additions & 0 deletions lib/modules/manager/flux/extract.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import { extractAllPackageFiles, extractPackageFile } from '.';

const config: ExtractConfig = {};
const adminConfig: RepoGlobalConfig = { localDir: '' };
const fixtureHelmChart = Fixtures.get('helmChart.yaml');
const fixtureHelmChartRefRelease = Fixtures.get('helmChartRefRelease.yaml');

describe('modules/manager/flux/extract', () => {
beforeEach(() => {
Expand Down Expand Up @@ -150,6 +152,22 @@ describe('modules/manager/flux/extract', () => {
});
});

it('ignores HelmRelease resources without any chart reference', () => {
const result = extractPackageFile(
codeBlock`
apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
name: sealed-secrets
namespace: kube-system
spec:
interval: 10m
`,
'test.yaml',
);
expect(result).toBeNull();
});

it('ignores HelmRelease resources without a chart name', () => {
const result = extractPackageFile(
codeBlock`
Expand Down Expand Up @@ -276,6 +294,35 @@ describe('modules/manager/flux/extract', () => {
expect(result).toBeNull();
});

it('does not match HelmRelease resources using chartRef without a namespace', () => {
const result = extractPackageFile(
codeBlock`
${fixtureHelmChart}
---
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: sealed-secrets
namespace: kube-system
spec:
chartRef:
kind: HelmChart
name: sealed-secrets
`,
'test.yaml',
);
expect(result).toEqual({
deps: [
{
currentValue: '2.0.2',
datasource: HelmDatasource.id,
depName: 'sealed-secrets',
skipReason: 'unknown-registry',
},
],
});
});

it('ignores HelmRepository resources without a namespace', () => {
const result = extractPackageFile(
codeBlock`
Expand Down Expand Up @@ -325,6 +372,68 @@ describe('modules/manager/flux/extract', () => {
});
});

it('ignores HelmRelease resources using a chartRef without a HelmChart', () => {
const result = extractPackageFile(
fixtureHelmChartRefRelease,
'test.yaml',
);
expect(result).toBeNull();
});

it('extracts HelmRelease resources using a chartRef without a valid HelmRepository', () => {
const result = extractPackageFile(
codeBlock`
${fixtureHelmChartRefRelease}
---
${fixtureHelmChart}
`,
'test.yaml',
);
expect(result).toEqual({
deps: [
{
currentValue: '2.0.2',
datasource: HelmDatasource.id,
depName: 'sealed-secrets',
skipReason: 'unknown-registry',
},
],
});
});

it('ignores HelmRelease resources using a chartRef targetting an OCIRepository', () => {
const result = extractPackageFile(
codeBlock`
${Fixtures.get('ociSource.yaml')}
---
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: kyverno-controller
namespace: kube-system
spec:
chartRef:
kind: OCIRepository
name: kyverno-controller
namespace: kube-system
`,
'test.yaml',
);
expect(result).toEqual({
deps: [
{
autoReplaceStringTemplate:
'{{#if newValue}}{{newValue}}{{/if}}{{#if newDigest}}@{{newDigest}}{{/if}}',
currentDigest: undefined,
currentValue: 'v1.8.2',
depName: 'ghcr.io/kyverno/manifests/kyverno',
datasource: DockerDatasource.id,
replaceString: 'v1.8.2',
},
],
});
});

it('ignores GitRepository without a tag nor a commit', () => {
const result = extractPackageFile(
codeBlock`
Expand Down Expand Up @@ -875,5 +984,27 @@ describe('modules/manager/flux/extract', () => {
]);
expect(result).toBeNull();
});

it('should handle HelmRepository with chartRef', async () => {
const result = await extractAllPackageFiles(config, [
'lib/modules/manager/flux/__fixtures__/helmChartRefRelease.yaml',
'lib/modules/manager/flux/__fixtures__/helmChart.yaml',
'lib/modules/manager/flux/__fixtures__/helmSource.yaml',
]);
expect(result).toEqual([
{
deps: [
{
currentValue: '2.0.2',
datasource: HelmDatasource.id,
depName: 'sealed-secrets',
registryUrls: ['https://bitnami-labs.github.io/sealed-secrets'],
},
],
packageFile:
'lib/modules/manager/flux/__fixtures__/helmChartRefRelease.yaml',
},
]);
});
});
});
Loading
Loading