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/helm-values): add image support in helm values manager #29828

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 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
9 changes: 7 additions & 2 deletions lib/modules/manager/helm-values/extract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,15 @@
Object.entries(parsedContent).forEach(([key, value]) => {
if (matchesHelmValuesDockerHeuristic(key, value)) {
const currentItem = value;

let registry = currentItem.registry;
registry = registry ? `${registry}/` : '';
const repository = String(currentItem.repository);
if (
currentItem.repository === undefined &&
currentItem.image === undefined
) {
logger.debug('repository and image are both undefined');

Check warning on line 57 in lib/modules/manager/helm-values/extract.ts

View check run for this annotation

Codecov / codecov/patch

lib/modules/manager/helm-values/extract.ts#L57

Added line #L57 was not covered by tests
KyriosGN0 marked this conversation as resolved.
Show resolved Hide resolved
}
const repository = `${currentItem.repository ?? currentItem.image}`;
const tag = `${currentItem.tag ?? currentItem.version}`;
packageDependencies.push(getHelmDep(registry, repository, tag, config));
} else if (matchesHelmValuesInlineImage(key, value)) {
Expand Down
5 changes: 5 additions & 0 deletions lib/modules/manager/helm-values/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,15 @@ image:
tag: v1.0.0
registry: registry.example.com # optional key, will default to "docker.io"


KyriosGN0 marked this conversation as resolved.
Show resolved Hide resolved
image:
repository: 'some-docker/dependency'
version: v1.0.0

image:
image: 'some-docker/dependency'
version: v1.0.0

coreImage:
registry: docker.io
repository: bitnami/harbor-core
Expand Down
3 changes: 2 additions & 1 deletion lib/modules/manager/helm-values/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export interface HelmDockerImageDependencyBasic {
registry?: string;
repository: string;
repository?: string;
image?: string;
}

export interface HelmDockerImageDependencyTag
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/manager/helm-values/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export function matchesHelmValuesDockerHeuristic(
parentKeyRe.test(parentKey) &&
data &&
typeof data === 'object' &&
hasKey('repository', data) &&
(hasKey('repository', data) || hasKey('image', data)) &&
(hasKey('tag', data) || hasKey('version', data))
);
}
Expand Down
Loading