diff --git a/lib/workers/global/config/parse/env.spec.ts b/lib/workers/global/config/parse/env.spec.ts index 7222c42a55a..5ac19acafd6 100644 --- a/lib/workers/global/config/parse/env.spec.ts +++ b/lib/workers/global/config/parse/env.spec.ts @@ -314,7 +314,8 @@ describe('workers/global/config/parse/env', () => { RENOVATE_X_DELETE_CONFIG_FILE: 'true', RENOVATE_X_S3_ENDPOINT: 'endpoint', RENOVATE_X_S3_PATH_STYLE: 'true', - RENOVATE_X_REPO_CACHE_FORCE_LOCAL: 'true', + // NOTE that a non-empty string is treated as `true` + RENOVATE_X_REPO_CACHE_FORCE_LOCAL: 'enabled', }; const config = await env.getConfig(envParam); expect(config).toMatchObject({ @@ -330,6 +331,14 @@ describe('workers/global/config/parse/env', () => { }); }); + it('does not migrate empty RENOVATE_X_REPO_CACHE_FORCE_LOCAL', async () => { + const envParam: NodeJS.ProcessEnv = { + RENOVATE_X_REPO_CACHE_FORCE_LOCAL: '', + }; + const config = await env.getConfig(envParam); + expect(config.repositoryCacheForceLocal).toBeUndefined(); + }); + describe('RENOVATE_CONFIG tests', () => { let processExit: MockInstance<(code?: number | string | null) => never>; diff --git a/lib/workers/global/config/parse/env.ts b/lib/workers/global/config/parse/env.ts index 2375ba39c75..d74af8d0b3f 100644 --- a/lib/workers/global/config/parse/env.ts +++ b/lib/workers/global/config/parse/env.ts @@ -1,4 +1,4 @@ -import { isArray } from '@sindresorhus/is'; +import { isArray, isNonEmptyString } from '@sindresorhus/is'; import JSON5 from 'json5'; import { getOptions } from '../../../../config/options/index.ts'; import type { AllConfig } from '../../../../config/types.ts'; @@ -117,6 +117,9 @@ function massageConvertedExperimentalVars( // special case to use a more consistent prefix with other `repositoryCache` options if (key === 'RENOVATE_X_REPO_CACHE_FORCE_LOCAL') { newKey = 'RENOVATE_REPOSITORY_CACHE_FORCE_LOCAL'; + if (isNonEmptyString(env[key])) { + env[key] = 'true'; + } } result[newKey] = env[key];