renovatebot / renovate

Home of the Renovate CLI: Cross-platform Dependency Automation by Mend.io
https://mend.io/renovate
GNU Affero General Public License v3.0
17.55k stars 2.3k forks source link

Evaluate pr/branch limits per-branch #32133

Open rarkins opened 1 week ago

rarkins commented 1 week ago

Describe the proposed change(s).

Current, limit are calculated prior to branch execution: https://github.com/renovatebot/renovate/blob/ed7b17acc9d03bc56bedccb7d39cff5b9c5c844d/lib/workers/repository/process/write.ts#L130-L138

And evaluated within branch execution such as https://github.com/renovatebot/renovate/blob/ed7b17acc9d03bc56bedccb7d39cff5b9c5c844d/lib/workers/repository/update/branch/index.ts#L212-L224

Much of the logic is also inside https://github.com/renovatebot/renovate/blob/main/lib/workers/repository/process/limits.ts

Instead of having global limits as today, we should instead allow separate limits per-branch, and evaluate those limits per-branch instead. This means removing these global limit settings:

And instead passing the relevant limit like prBranchLimit and prConcurrentLimit through to the "is limit reached?" functions.

Ideally the point in our workers where these limits are evaluated is kept the same as today so that there is "less changes" and risk of breaking things. And so the change is that the limits are passed through rather than used globally.

Note: commits will still be global

rarkins commented 1 week ago

I've begun initial refactorings for this in https://github.com/renovatebot/renovate/compare/feat/per-branch-limits?expand=1