fix(manager/fleet): do not merge version into customization objects ()

Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
pull/20228/head 34.124.1
Sebastian Poxhofer 2023-02-04 16:44:25 +01:00 committed by GitHub
parent 196ed35dcb
commit 5c5cde9d78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 37 additions and 2 deletions

View File

@ -24,3 +24,17 @@ targetCustomizations:
helm:
version: "v1.8.2"
repo: https://charts.example.com
---
defaultNamespace: cert-manager
helm:
chart: cert-manager
repo: https://charts.jetstack.io
releaseName: custom-cert-manager
version: v1.8.0
values:
installCRDs: true
targetCustomizations:
- name: cluster1
values:
some: customization

View File

@ -104,6 +104,22 @@ kind: Fleet
registryUrls: ['https://charts.example.com'],
depType: 'fleet',
},
{
currentValue: 'v1.8.0',
datasource: 'helm',
depName: 'cert-manager',
packageName: 'cert-manager',
registryUrls: ['https://charts.jetstack.io'],
depType: 'fleet',
},
{
datasource: 'helm',
depName: 'cluster1',
packageName: 'cert-manager',
registryUrls: ['https://charts.jetstack.io'],
depType: 'fleet',
skipReason: 'no-version',
},
]);
});

View File

@ -87,10 +87,15 @@ function extractFleetFile(doc: FleetFile): PackageDependency[] {
result.push(extractFleetHelmBlock(doc.helm));
if (!is.undefined(doc.targetCustomizations)) {
// remove version from helm block to allow usage of variables defined in the global block, but do not create PRs
// if there is no version defined in the customization.
const helmBlockContext: FleetHelmBlock = { ...doc.helm };
delete helmBlockContext.version;
for (const custom of doc.targetCustomizations) {
const dep = extractFleetHelmBlock({
// merge base config with customization
...doc.helm,
...helmBlockContext,
...custom.helm,
});
result.push({

View File

@ -28,7 +28,7 @@ export interface FleetFile {
export interface FleetHelmBlock {
chart: string;
repo?: string;
version: string;
version?: string;
}
export interface FleetFileHelm extends FleetHelmBlock {