diff --git a/lib/manager/helm-values/__fixtures__/multi_and_nested_image_values.yaml b/lib/manager/helm-values/__fixtures__/multi_and_nested_image_values.yaml index 23690cdd966d188c71a458f9966b361683cd2ff5..afb39690328d719c9ce4cd0d028e6336d56db9a9 100644 --- a/lib/manager/helm-values/__fixtures__/multi_and_nested_image_values.yaml +++ b/lib/manager/helm-values/__fixtures__/multi_and_nested_image_values.yaml @@ -1,4 +1,6 @@ --- +inline_image: docker.io/library/nginx:1.18-alpine + api: image: image: diff --git a/lib/manager/helm-values/__snapshots__/extract.spec.ts.snap b/lib/manager/helm-values/__snapshots__/extract.spec.ts.snap index 7c463545d41844c42ae7f039035a1edbc678ba3c..ae90d042fbadaf16c602763b6569f0c2214bc09d 100644 --- a/lib/manager/helm-values/__snapshots__/extract.spec.ts.snap +++ b/lib/manager/helm-values/__snapshots__/extract.spec.ts.snap @@ -3,6 +3,14 @@ exports[`manager/helm-values/extract extractPackageFile() extracts from complex values file correctly" 1`] = ` Object { "deps": Array [ + Object { + "autoReplaceStringTemplate": "{{depName}}{{#if newValue}}:{{newValue}}{{/if}}{{#if newDigest}}@{{newDigest}}{{/if}}", + "currentDigest": undefined, + "currentValue": "1.18-alpine", + "datasource": "docker", + "depName": "docker.io/library/nginx", + "replaceString": "docker.io/library/nginx:1.18-alpine", + }, Object { "autoReplaceStringTemplate": "{{newValue}}{{#if newDigest}}@{{newDigest}}{{/if}}", "currentDigest": undefined, diff --git a/lib/manager/helm-values/extract.spec.ts b/lib/manager/helm-values/extract.spec.ts index 08213783dce1a53c6119e74eaa3a08f0b0a76f3d..a2a1c6196d4cb97abdb420d0b958a2611e671ec9 100644 --- a/lib/manager/helm-values/extract.spec.ts +++ b/lib/manager/helm-values/extract.spec.ts @@ -40,7 +40,7 @@ describe('manager/helm-values/extract', () => { it('extracts from complex values file correctly"', () => { const result = extractPackageFile(helmMultiAndNestedImageValues); expect(result).toMatchSnapshot(); - expect(result.deps).toHaveLength(4); + expect(result.deps).toHaveLength(5); }); }); }); diff --git a/lib/manager/helm-values/extract.ts b/lib/manager/helm-values/extract.ts index 6b962e598713badeee4886e9e22bb0e7ecbd2363..a57a2876a0a1360ecc94b2eab2596b784b61e3e7 100644 --- a/lib/manager/helm-values/extract.ts +++ b/lib/manager/helm-values/extract.ts @@ -4,7 +4,10 @@ import { id as dockerVersioning } from '../../versioning/docker'; import { getDep } from '../dockerfile/extract'; import type { PackageDependency, PackageFile } from '../types'; import type { HelmDockerImageDependency } from './types'; -import { matchesHelmValuesDockerHeuristic } from './util'; +import { + matchesHelmValuesDockerHeuristic, + matchesHelmValuesInlineImage, +} from './util'; function getHelmDep({ registry, @@ -45,6 +48,9 @@ function findDependencies( const repository = String(currentItem.repository); const tag = String(currentItem.tag); packageDependencies.push(getHelmDep({ repository, tag, registry })); + } else if (matchesHelmValuesInlineImage(key, parsedContent[key])) { + const currentItem = parsedContent[key]; + packageDependencies.push(getDep(currentItem)); } else { findDependencies(parsedContent[key], packageDependencies); } diff --git a/lib/manager/helm-values/util.ts b/lib/manager/helm-values/util.ts index ffc9ee74cbc502b214414b653bf9667f6280c79a..f1707aef7bff602b3b2fd4dd2081df579f66a941 100644 --- a/lib/manager/helm-values/util.ts +++ b/lib/manager/helm-values/util.ts @@ -30,3 +30,10 @@ export function matchesHelmValuesDockerHeuristic( hasKey('tag', data) ); } + +export function matchesHelmValuesInlineImage( + parentKey: string, + data: unknown +): data is string { + return parentKeyRe.test(parentKey) && data && typeof data === 'string'; +}