Files
Sergei Zharinov 930cf6633c refactor: Rewrite imports with .ts extensions (#40700)
fix: Additional vi.mock path corrections and prettier formatting
2026-01-26 22:48:17 +00:00

26 lines
852 B
TypeScript

import semver from 'semver';
import upath from 'upath';
import type { ExtraEnv } from '../../../util/exec/types.ts';
import { privateCacheDir } from '../../../util/fs/index.ts';
import type { UpdateArtifactsConfig } from '../types.ts';
export function generateHelmEnvs(config: UpdateArtifactsConfig): ExtraEnv {
const cacheDir = privateCacheDir();
const envs: ExtraEnv = {
// set cache and config files to a path in privateCacheDir to prevent file and credential leakage
HELM_REGISTRY_CONFIG: upath.join(cacheDir, 'registry.json'),
HELM_REPOSITORY_CONFIG: upath.join(cacheDir, 'repositories.yaml'),
HELM_REPOSITORY_CACHE: upath.join(cacheDir, 'repositories'),
};
if (
config.constraints?.helm &&
!semver.intersects(config.constraints.helm, '>=3.8.0')
) {
envs.HELM_EXPERIMENTAL_OCI = '1';
}
return envs;
}