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

fix(config): RENOVATE_X_EAGER_GLOBAL_EXTENDS #28144

Merged
merged 1 commit into from Mar 26, 2024
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/usage/self-hosted-experimental.md
Expand Up @@ -93,6 +93,10 @@ If set to any value, Renovate will use the Docker Hub API (`https://hub.docker.c
If set to an integer, Renovate will use this as max page number for docker tags lookup on docker registries, instead of the default 20 pages.
This is useful for registries which ignores the `n` parameter in the query string and only return 50 tags per page.

## `RENOVATE_X_EAGER_GLOBAL_EXTENDS`

Resolve and merge `globalExtends` presets before other global config, instead of after.

## `RENOVATE_X_EXEC_GPID_HANDLE`

If set, Renovate will terminate the whole process group of a terminated child process spawned by Renovate.
Expand Down
16 changes: 16 additions & 0 deletions lib/workers/global/index.spec.ts
Expand Up @@ -45,6 +45,7 @@ describe('workers/global/index', () => {
initPlatform.mockImplementation((input) => Promise.resolve(input));
delete process.env.AWS_SECRET_ACCESS_KEY;
delete process.env.AWS_SESSION_TOKEN;
delete process.env.RENOVATE_X_EAGER_GLOBAL_EXTENDS;
});

describe('getRepositoryConfig', () => {
Expand Down Expand Up @@ -87,6 +88,21 @@ describe('workers/global/index', () => {
expect(addSecretForSanitizing).toHaveBeenCalledTimes(2);
});

it('resolves global presets first', async () => {
process.env.RENOVATE_X_EAGER_GLOBAL_EXTENDS = 'true';
parseConfigs.mockResolvedValueOnce({
repositories: [],
globalExtends: [':pinVersions'],
hostRules: [{ matchHost: 'github.com', token: 'abc123' }],
});
presets.resolveConfigPresets.mockResolvedValueOnce({});
await expect(globalWorker.start()).resolves.toBe(0);
expect(presets.resolveConfigPresets).toHaveBeenCalledWith({
extends: [':pinVersions'],
});
expect(parseConfigs).toHaveBeenCalledTimes(1);
});

it('resolves global presets immediately', async () => {
parseConfigs.mockResolvedValueOnce({
repositories: [],
Expand Down
15 changes: 11 additions & 4 deletions lib/workers/global/index.ts
Expand Up @@ -144,10 +144,17 @@ export async function start(): Promise<number> {
config = await getGlobalConfig();
if (config?.globalExtends) {
// resolve global presets immediately
config = mergeChildConfig(
config,
await resolveGlobalExtends(config.globalExtends),
);
if (process.env.RENOVATE_X_EAGER_GLOBAL_EXTENDS) {
config = mergeChildConfig(
await resolveGlobalExtends(config.globalExtends),
config,
);
} else {
config = mergeChildConfig(
config,
await resolveGlobalExtends(config.globalExtends),
);
}
}
// initialize all submodules
config = await globalInitialize(config);
Expand Down