Skip to content
Snippets Groups Projects
Unverified Commit 6fefb268 authored by Michael Kriese's avatar Michael Kriese Committed by GitHub
Browse files

fix(helm-values): update digest if available (#7202)

parent 605346f5
No related branches found
No related tags found
No related merge requests found
......@@ -17,7 +17,7 @@ someOtherKey:
- image:
registry: docker.io
repository: bitnami/postgresql
tag: 11.5.0-debian-9-r0
tag: 11.5.0-debian-9-r0@sha256:4762726f1471ef048dd807afdc0e19265e95ffdcc7cb4a34891f680290022809
some-non-image-related-key: 'with-some-value'
empty_key:
......@@ -8,18 +8,21 @@ Object {
"currentValue": "11.6.0-debian-9-r0",
"datasource": "docker",
"depName": "bitnami/postgresql",
"replaceString": "11.6.0-debian-9-r0",
},
Object {
"currentDigest": undefined,
"currentValue": "0.7.0-debian-9-r12",
"datasource": "docker",
"depName": "docker.io/bitnami/postgres-exporter",
"replaceString": "0.7.0-debian-9-r12",
},
Object {
"currentDigest": undefined,
"currentDigest": "sha256:4762726f1471ef048dd807afdc0e19265e95ffdcc7cb4a34891f680290022809",
"currentValue": "11.5.0-debian-9-r0",
"datasource": "docker",
"depName": "docker.io/bitnami/postgresql",
"replaceString": "11.5.0-debian-9-r0@sha256:4762726f1471ef048dd807afdc0e19265e95ffdcc7cb4a34891f680290022809",
},
],
}
......@@ -33,6 +36,7 @@ Object {
"currentValue": "1.16.1",
"datasource": "docker",
"depName": "nginx",
"replaceString": "1.16.1",
},
],
}
......
......@@ -8,6 +8,20 @@ import {
matchesHelmValuesDockerHeuristic,
} from './util';
function getHelmDep({
registry,
repository,
tag,
}: {
registry: string;
repository: string;
tag: string;
}): PackageDependency {
const dep = getDep(`${registry}${repository}:${tag}`, false);
dep.replaceString = tag;
return dep;
}
/**
* Recursively find all supported dependencies in the yaml object.
*
......@@ -29,8 +43,7 @@ function findDependencies(
registry = registry ? `${registry}/` : '';
const repository = String(currentItem.repository);
const tag = String(currentItem.tag);
const currentFrom = `${registry}${repository}:${tag}`;
packageDependencies.push(getDep(currentFrom, false));
packageDependencies.push(getHelmDep({ repository, tag, registry }));
} else {
findDependencies(parsedContent[key], packageDependencies);
}
......@@ -39,7 +52,7 @@ function findDependencies(
}
export function extractPackageFile(content: string): PackageFile {
let parsedContent;
let parsedContent: Record<string, unknown> | HelmDockerImageDependency;
try {
// a parser that allows extracting line numbers would be preferable, with
// the current approach we need to match anything we find again during the update
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment