From 766ba9adcb35c65f8b216b366a8496d77a78b673 Mon Sep 17 00:00:00 2001 From: Rhys Arkins Date: Sat, 28 Jan 2023 08:52:05 +0100 Subject: [PATCH] feat(config)!: non-zero defaults for PR concurrent, hourly limits (#19958) Sets new defaults: - `prConcurrentLimit`: 10 (instead of 0) - `prHourlyLimit`: 2 (instead of 0) Closes #19800 BREAKING CHANGE: Renovate now defaults to applying hourly and concurrent PR limits. To revert to unlimited, configure them back to `0`. --- lib/config/options/index.ts | 8 ++++---- lib/config/presets/index.spec.ts | 2 -- lib/config/presets/internal/config.ts | 2 -- lib/modules/platform/codecommit/index.md | 1 - lib/workers/repository/process/limits.spec.ts | 18 ++++++++++-------- 5 files changed, 14 insertions(+), 17 deletions(-) diff --git a/lib/config/options/index.ts b/lib/config/options/index.ts index 5239b8d3ac68c3..9465b24c8fd8c7 100644 --- a/lib/config/options/index.ts +++ b/lib/config/options/index.ts @@ -1581,16 +1581,16 @@ const options: RenovateOptions[] = [ { name: 'prHourlyLimit', description: - 'Rate limit PRs to maximum x created per hour. 0 (default) means no limit.', + 'Rate limit PRs to maximum x created per hour. 0 means no limit.', type: 'integer', - default: 0, // no limit + default: 2, }, { name: 'prConcurrentLimit', description: - 'Limit to a maximum of x concurrent branches/PRs. 0 (default) means no limit.', + 'Limit to a maximum of x concurrent branches/PRs. 0 means no limit.', type: 'integer', - default: 0, // no limit + default: 10, }, { name: 'branchConcurrentLimit', diff --git a/lib/config/presets/index.spec.ts b/lib/config/presets/index.spec.ts index 3bf5d5fffb5c49..92784b5a581251 100644 --- a/lib/config/presets/index.spec.ts +++ b/lib/config/presets/index.spec.ts @@ -839,8 +839,6 @@ describe('config/presets/index', () => { ':dependencyDashboard', ':semanticPrefixFixDepsChoreOthers', ':ignoreModulesAndTests', - ':prHourlyLimit2', - ':prConcurrentLimit10', 'group:monorepos', 'group:recommended', 'workarounds:all', diff --git a/lib/config/presets/internal/config.ts b/lib/config/presets/internal/config.ts index 355135deaa0727..040c102aae93c5 100644 --- a/lib/config/presets/internal/config.ts +++ b/lib/config/presets/internal/config.ts @@ -9,8 +9,6 @@ export const presets: Record = { ':dependencyDashboard', ':semanticPrefixFixDepsChoreOthers', ':ignoreModulesAndTests', - ':prHourlyLimit2', - ':prConcurrentLimit10', 'group:monorepos', 'group:recommended', 'workarounds:all', diff --git a/lib/modules/platform/codecommit/index.md b/lib/modules/platform/codecommit/index.md index de47f7b3aa5ab0..6b74cc66edf58b 100644 --- a/lib/modules/platform/codecommit/index.md +++ b/lib/modules/platform/codecommit/index.md @@ -133,7 +133,6 @@ module.exports = { password: 'SECRET_ACCESS_KEY_GOES_HERE', token: 'AWS_SESSION_TOKEN_GOES_HERE', gitAuthor: 'your_email@domain', - prConcurrentLimit: 10, packageRules: [ { matchPackageNames: ['package_name', 'package_name2'], diff --git a/lib/workers/repository/process/limits.spec.ts b/lib/workers/repository/process/limits.spec.ts index 2b8feb28536ece..4e09fb513daee0 100644 --- a/lib/workers/repository/process/limits.spec.ts +++ b/lib/workers/repository/process/limits.spec.ts @@ -41,13 +41,14 @@ describe('workers/repository/process/limits', () => { }); it('returns prHourlyLimit if errored', async () => { - config.prHourlyLimit = 2; + config.prHourlyLimit = 5; platform.getPrList.mockRejectedValue('Unknown error'); const res = await limits.getPrHourlyRemaining(config); - expect(res).toBe(2); + expect(res).toBe(5); }); it('returns 99 if no hourly limit', async () => { + config.prHourlyLimit = 0; const res = await limits.getPrHourlyRemaining(config); expect(res).toBe(99); }); @@ -73,6 +74,7 @@ describe('workers/repository/process/limits', () => { }); it('returns 99 if no concurrent limit', async () => { + config.prConcurrentLimit = 0; const res = await limits.getConcurrentPrsRemaining(config, []); expect(res).toBe(99); }); @@ -80,16 +82,16 @@ describe('workers/repository/process/limits', () => { describe('getPrsRemaining()', () => { it('returns hourly limit', async () => { - config.prHourlyLimit = 5; + config.prHourlyLimit = 1; platform.getPrList.mockResolvedValueOnce([]); const res = await limits.getPrsRemaining(config, []); - expect(res).toBe(5); + expect(res).toBe(1); }); it('returns concurrent limit', async () => { - config.prConcurrentLimit = 5; + config.prConcurrentLimit = 1; const res = await limits.getPrsRemaining(config, []); - expect(res).toBe(5); + expect(res).toBe(1); }); }); @@ -120,9 +122,9 @@ describe('workers/repository/process/limits', () => { expect(res).toBe(99); }); - it('returns 99 if no limits are set', async () => { + it('returns 10 if no limits are set', async () => { const res = await limits.getConcurrentBranchesRemaining(config, []); - expect(res).toBe(99); + expect(res).toBe(10); }); it('returns prConcurrentLimit if errored', async () => {