mirror of
https://github.com/renovatebot/renovate.git
synced 2026-10-26 07:20:39 +00:00
c8ce514ff3
Extract a shared generateRegistryLoginCmd(name, registry) helper in helmv3/common.ts that strips the oci:// prefix, derives the host and looks up the matching host rule before delegating to generateLoginCmd. helmv3/artifacts.ts and helmfile/artifacts.ts now both call this helper instead of each building a RepositoryRule inline, removing the stale oci:// TODO. helmfile/utils.ts loses its duplicate generateRegistryLoginCmd, and its unrelated isOCIRegistry(repository) (checking the oci flag) is renamed to isOciRepositoryFlagSet so it no longer collides in name with helmv3/oci.ts's prefix-based isOCIRegistry(string), which helmfile/extract.ts also imports. Addresses audit finding M8. Generated `helm registry login` commands are unchanged, proved by the existing artifacts specs passing with their original expectations untouched.
30 lines
985 B
TypeScript
30 lines
985 B
TypeScript
import upath from 'upath';
|
|
|
|
import { getParentDir, localPathExists } from '../../../util/fs/index.ts';
|
|
|
|
import type { HelmRelease, HelmRepository } from './schema.ts';
|
|
|
|
/** Returns true if a helmfile release contains kustomize specific keys **/
|
|
export function kustomizationsKeysUsed(release: HelmRelease): boolean {
|
|
return (
|
|
release.strategicMergePatches !== undefined ||
|
|
release.jsonPatches !== undefined ||
|
|
release.transformers !== undefined
|
|
);
|
|
}
|
|
|
|
/** Returns true if a helmfile release uses a local chart with a kustomization.yaml file **/
|
|
export function localChartHasKustomizationsYaml(
|
|
release: HelmRelease,
|
|
helmFileYamlFileName: string,
|
|
): Promise<boolean> {
|
|
const helmfileYamlParentDir = getParentDir(helmFileYamlFileName) || '';
|
|
return localPathExists(
|
|
upath.join(helmfileYamlParentDir, release.chart, 'kustomization.yaml'),
|
|
);
|
|
}
|
|
|
|
export function isOciRepositoryFlagSet(repository: HelmRepository): boolean {
|
|
return repository.oci === true;
|
|
}
|