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.67k stars 2.33k forks source link

repoConfig.packageRules.extends no longer works #14974

Closed anomiex closed 2 years ago

anomiex commented 2 years ago

How are you running Renovate?

Self-hosted

If you're self-hosting Renovate, tell us what version of Renovate you run.

32.11.3

Please select which platform you are using if self-hosting.

github.com

If you're self-hosting Renovate, tell us what version of the platform you run.

No response

Was this something which used to work for you, and then stopped?

It used to work, and then stopped

Describe the bug

When using packageRules with expands in the config.js, it no longer expands the presets.

Reproduction repo is https://github.com/anomiex/renovate-test/

It seems the patch that originally fixed this bug was reverted because it broke some other feature that seems to be completely undocumented (#14827)?

Relevant debug logs

Logs The config in the reproduction repo sets `separateMajorMinor` for `monorepo:wordpress`. The update record for packages in that monorepo should show "bucket" as "latest", as here with 32.9.3: ``` 2022-04-05T20:15:38.0862720Z { 2022-04-05T20:15:38.0862959Z "depType": "dependencies", 2022-04-05T20:15:38.0863320Z "depName": "@wordpress/i18n", 2022-04-05T20:15:38.0863576Z "currentValue": "4.4.0", 2022-04-05T20:15:38.0863818Z "datasource": "npm", 2022-04-05T20:15:38.0864089Z "prettyDepType": "dependency", 2022-04-05T20:15:38.0864325Z "depIndex": 0, 2022-04-05T20:15:38.0864565Z "updates": [ 2022-04-05T20:15:38.0864771Z { 2022-04-05T20:15:38.0864987Z "bucket": "latest", 2022-04-05T20:15:38.0865232Z "newVersion": "4.5.0", 2022-04-05T20:15:38.0865456Z "newValue": "4.5.0", 2022-04-05T20:15:38.0865829Z "releaseTimestamp": "2022-03-23T13:52:36.437Z", 2022-04-05T20:15:38.0866095Z "newMajor": 4, 2022-04-05T20:15:38.0866323Z "newMinor": 5, 2022-04-05T20:15:38.0866554Z "updateType": "minor", 2022-04-05T20:15:38.0866931Z "branchName": "renovate-sh/wordpress-monorepo" 2022-04-05T20:15:38.0867195Z } 2022-04-05T20:15:38.0867388Z ], 2022-04-05T20:15:38.0867590Z "warnings": [], 2022-04-05T20:15:38.0867819Z "versioning": "npm", 2022-04-05T20:15:38.0868125Z "sourceUrl": "https://github.com/WordPress/gutenberg", 2022-04-05T20:15:38.0868448Z "sourceDirectory": "packages/i18n", 2022-04-05T20:15:38.0868713Z "currentVersion": "4.4.0", 2022-04-05T20:15:38.0868968Z "isSingleVersion": true, 2022-04-05T20:15:38.0869215Z "fixedVersion": "4.4.0" 2022-04-05T20:15:38.0869431Z }, ``` With 32.11.3, we instead get "bucket" set to "non-major", indicating that the `separateMajorMinor` was not applied. ``` 2022-04-05T20:18:57.4826676Z { 2022-04-05T20:18:57.4826894Z "packageFile": "package.json", 2022-04-05T20:18:57.4827111Z "deps": [ 2022-04-05T20:18:57.4827302Z { 2022-04-05T20:18:57.4827516Z "depType": "dependencies", 2022-04-05T20:18:57.4827770Z "depName": "@wordpress/i18n", 2022-04-05T20:18:57.4828003Z "currentValue": "4.4.0", 2022-04-05T20:18:57.4828239Z "datasource": "npm", 2022-04-05T20:18:57.4828545Z "prettyDepType": "dependency", 2022-04-05T20:18:57.4828787Z "depIndex": 0, 2022-04-05T20:18:57.4829081Z "updates": [ 2022-04-05T20:18:57.4829279Z { 2022-04-05T20:18:57.4829556Z "bucket": "non-major", 2022-04-05T20:18:57.4829794Z "newVersion": "4.5.0", 2022-04-05T20:18:57.4830005Z "newValue": "4.5.0", 2022-04-05T20:18:57.4830355Z "releaseTimestamp": "2022-03-23T13:52:36.437Z", 2022-04-05T20:18:57.4830614Z "newMajor": 4, 2022-04-05T20:18:57.4830829Z "newMinor": 5, 2022-04-05T20:18:57.4831050Z "updateType": "minor", 2022-04-05T20:18:57.4831410Z "branchName": "renovate-sh/wordpress-monorepo" 2022-04-05T20:18:57.4831656Z } 2022-04-05T20:18:57.4831839Z ], 2022-04-05T20:18:57.4832030Z "warnings": [], 2022-04-05T20:18:57.4832255Z "versioning": "npm", 2022-04-05T20:18:57.4832549Z "sourceUrl": "https://github.com/WordPress/gutenberg", 2022-04-05T20:18:57.4832863Z "sourceDirectory": "packages/i18n", 2022-04-05T20:18:57.4833118Z "currentVersion": "4.4.0", 2022-04-05T20:18:57.4833362Z "isSingleVersion": true, 2022-04-05T20:18:57.4833603Z "fixedVersion": "4.4.0" 2022-04-05T20:18:57.4833808Z }, ```

Have you created a minimal reproduction repository?

I have linked to a minimal reproduction repository in the bug description

viceice commented 2 years ago

https://docs.renovatebot.com/self-hosted-configuration/#globalextends

in general it's expected that normal extends will be resolved at repo stage, so if you use it in global config, the preset will override any global config.

anomiex commented 2 years ago

https://docs.renovatebot.com/self-hosted-configuration/#globalextends

in general it's expected that normal extends will be resolved at repo stage, so if you use it in global config, the preset will override any global config.

I want both extends at the top level and inside packageRules to be resolved at the repo stage. The latter is not happening (it's not being expanded at all), hence this bug.

Also globalExtends doesn't seem to work inside packageRules, so that wouldn't be an option anyway.

rarkins commented 2 years ago

We want extends fields will be lazily resolved at the repo stage, regardless of where they are. Only globalExtends are eagerly resolved.

I think the above is compatible with what you want - please confirm.

Also please confirm if I understand these right?

anomiex commented 2 years ago

We want extends fields will be lazily resolved at the repo stage, regardless of where they are. Only globalExtends are eagerly resolved.

I think the above is compatible with what you want - please confirm.

That sounds correct.

Also please confirm if I understand these right?

* `extends` within `packageRules` within `renovate.json` are resolved as expected?

* `extends` within `packageRules` within `config.js` are never resolved?

That is the current situation, yes.

renovate-release commented 2 years ago

:tada: This issue has been resolved in version 32.84.3 :tada:

The release is available on:

Your semantic-release bot :package::rocket: