Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
11 changes: 10 additions & 1 deletion lib/workers/global/config/parse/env.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -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>;

Expand Down
5 changes: 4 additions & 1 deletion lib/workers/global/config/parse/env.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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];
Expand Down
Loading