Repository navigation
feat(containerbase): add packageRules support for containerbase dynamic install - #43635
mistabanasik wants to merge 8 commits into
Conversation
|
I think we have some planned work around this |
|
Well now when I think of it, it might be better idea to reuse |
|
I've added another commit - we should use full config returned from |
|
@jamietanna @viceice any thoughts on this PR? |
RahulGautamSingh
left a comment
There was a problem hiding this comment.
while we wait for maintainers review, could you please clean the pr title to not include the ...
|
Moving to draft until we get a chance to review the approach and work out if it matches where we want to go 👍🏼 |
|
I've changed my PR to rely purely on packageRules config without additional containerbasePackageRules. With new depType=tool-constraint we can also specifically address some packageRules to only target containerbase dynamic installs via matchDepTypes. @jamietanna I saw your comment in the other thread - well this PR + containerbase URL replace env variables are sufficient to make containerbase dynamic install work with self-hosted package mirrors. I think in the future there should be a way without needing to set URL replace env variables, but for now in my opinion this PR is sufficient. |
|
That's cool! I closed my PR so there's one less to review. |
| Package rules are also applied to tool installations when `binarySource=install` is used (containerbase dynamic installs). | ||
| Tools use `depType=tool-constraint`, so you can use `matchDepTypes: ["tool-constraint"]` to target them specifically. | ||
| For example, to override the Node.js tool datasource to a custom Artifactory registry: | ||
|
|
||
| ```json | ||
| { | ||
| "packageRules": [ | ||
| { | ||
| "matchDepNames": ["node"], | ||
| "matchDepTypes": ["tool-constraint"], | ||
| "overrideDatasource": "node-version", | ||
| "registryUrls": ["https://artifactory.example.com/nodejs"] | ||
| } | ||
| ] | ||
| } | ||
| ``` | ||
|
|
There was a problem hiding this comment.
I believe repository-level packageRules will not be taken into account, and if so, I believe you should address this via documentation.
(and that's why I preferred to document in self-hosted configuration instead)
viceice
left a comment
There was a problem hiding this comment.
Thanks for working on this, and sorry for the long wait. I don't think this is the right layer, for these reasons:
- Rule source: only the literal self-hosted
packageRulespassed toGlobalConfig.setare picked up. Rules from globalextendspresets,repositories[]entries, inherited config and repo config aren't included (see @felipecrs's open thread), so the docs promise more than the code does. - Leaks into tool installs: every matching admin rule now affects tool installs, not only rules targeting
tool-constraint. For example,matchDatasources: ['github-releases']withregistryUrls, ormatchDepNames: ['node']withoverrideDatasource, would silently change which tool versions get installed in existing setups. - Only half the problem: this only changes how the version is resolved.
install-toolstill downloads from containerbase's own URLs, so mirrors still need the URL-replace env vars, and a custom source can return versions containerbase can't install.
I'm working on a containerbase datasource (#46871), which resolves tool versions from containerbase's published version data and supports a mirror via registryUrls. I'd rather solve this with a dedicated admin setting for both the version mirror and the download mirror on top of that, instead of reusing packageRules here.
The branch also conflicts with recent containerbase.ts changes on main (#46587, #46580, #46823), so it needs a rebase either way.
Posted by Claude (Claude Code) on behalf of @viceice.
| delete result[option]; | ||
| } | ||
|
|
||
| GlobalConfig.config.containerbasePackageRules = config.packageRules; |
There was a problem hiding this comment.
A side effect hidden in set() that captures only the literal self-hosted packageRules. Presets, repositories[] entries, inherited config and repo config are never included.
| } | ||
|
|
||
| const { applyPackageRules } = await import('../package-rules/index.ts'); | ||
| return applyPackageRules({ |
There was a problem hiding this comment.
Rules without matchDepTypes match here too. Most tools use github-releases, so a generic admin rule for that datasource (or for npm, node, …) now changes tool lookups. If this stays, it should be opt-in, limited to rules that explicitly target tool-constraint, and pass through only the fields that make sense for a tool lookup.
| } | ||
|
|
||
| const { get: getVersioning } = | ||
| await import('../../modules/versioning/index.ts'); |
There was a problem hiding this comment.
Constraint matching and the stable check still use the tool's default versioning, while the lookup uses the versioning from the rules. Apply the rules first, so both use the same versioning.
| If multiple rules match a dependency, configurations from matching rules will be merged together. | ||
| The order of rules matters, because later rules may override configuration options from earlier ones, if they both specify the same option. | ||
|
|
||
| Package rules are also applied to tool installations when `binarySource=install` is used (containerbase dynamic installs). |
There was a problem hiding this comment.
Repo-level rules aren't applied, and this also runs in Docker mode, not only with binarySource=install. The downloads still need the URL-replace env vars as well.
|
Hi there, This PR appears to have been inactive for a while. Please let us know if you are still working on it, or if we can close it for now. Thanks, the Renovate team |
Changes
Renovate doesn't use packageRules when installing tools with containerbase, so for example changing repository url is not possible with binarySource=install.
This PR adds new option to instance global config,
containerbasePackageRuleswhich reusespackageRulesfor containerbase install-tool package resolutions.Link to discussion:
#43636
Context
Please select one of the following:
AI assistance disclosure
Did you use AI tools to create any part of this pull request?
Please select one option and, if yes, briefly describe how AI was used (e.g., code, tests, docs) and which tool(s) you used.
Yes, I've used AI tools to generate test cases.
Documentation (please check one with an [x])
How I've tested my work (please select one)
I have verified these changes via:
Code was tested on corporate self-hosted repository.