Skip to content

feat: allow overriding tool version lookups via global packageRules - #44641

Closed
felipecrs wants to merge 11 commits into
renovatebot:mainfrom
felipecrs:fix/containerbase-override
Closed

felipecrs wants to merge 11 commits into
renovatebot:mainfrom
felipecrs:fix/containerbase-override

Conversation

@felipecrs

@felipecrs felipecrs commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor

Changes

Some companies run Renovate in environments where strict security policy blocks most internet access: no github.com, no nodejs.org, no api.adoptium.net, etc. Tools like Artifactory can proxy file-based remote repos (Docker, npm, PyPI, RubyGems...), but not generic API-based lookups against arbitrary websites, including github.com itself, which Containerbase relies on for most tool version lookups.

The workaround I use: patch these lookups so they go through our internal Artifactory Docker registry, which proxies most upstream registries. It's not perfect (the mirror may occasionally have a version the containerbase/*-prebuild repos don't, or vice-versa), but it's far better than finding no versions at all and having to fall back to manual constraints in every repo's config.

This PR makes Containerbase's tool version lookups overridable by admins via packageRules in the global config. For example, to look up node versions from a Docker registry mirror instead of GitHub releases:

{
  "packageRules": [
    {
      "matchDatasources": ["github-releases"],
      "matchPackageNames": ["containerbase/node-prebuild"],
      "overrideDatasource": "docker",
      "overridePackageName": "artifactory.mycompany.com/dockerhub-remote/library/node",
      "versioning": "node",
      "extractVersion": "^(?<version>\\d+\\.\\d+\\.\\d+)$"
    }
  ]
}

Scope: this only changes where Renovate discovers the version list and which version string is chosen for install-tool <name> <version>. It does not change where install-tool downloads the binary from (Containerbase's normal install path). If downloads still need a blocked host, you also need a working install source (Containerbase mirror or binarySource=global with pre-installed tools).

The same global packageRules already apply to normal dependency updates (e.g. node-version, java-version). With this PR, one admin list can cover both dependency datasources and Containerbase tool version lookups. Prefer tight matchers (matchPackageNames / matchDepNames); broad rules like matchDatasources: ["github-releases"] without a package filter also hit tool lookups.

Note only bot/global config packageRules apply (repository-level packageRules do not), so repo users cannot redirect tool lookups.

Related: #43635, discussion #44608 (same problem; this reuses global packageRules instead of a new containerbasePackageRules option).

Context

Please select one of the following:

  • This closes an existing Issue, Closes: #
  • This doesn't close an Issue, but I accept the risk that this PR may be closed if maintainers disagree with its opening or implementation

Realized after the fact that this is related to:

AI assistance disclosure

Did you use AI tools to create any part of this pull request?

  • No — I did not use AI for this contribution.
  • Yes — minimal assistance (e.g., IDE autocomplete, small code completions, grammar fixes).
  • Yes — substantive assistance (AI-generated non‑trivial portions of code, tests, or documentation).
  • Yes — other (please describe):

Claude was used to implement this.

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests, but ran on a real repository, or
  • Both unit tests + ran on a real repository

The public repository: https://review.gerrithub.io/q/project:felipecrs/renovate-repro-override-tool-versions+is:open

With this config:

platform: "gerrit", // so that I can block api.github.com

// ...

hostRules: [
    // Disable all hosts (api.github.com and nodejs.org are the relevant ones)
    {
      enabled: false,
    },
    // Enable other ones
    {
      matchHost: 'review.gerrithub.io',
      enabled: true,
    },
    {
      matchHost: '.docker.io',
      enabled: true,
    },
    {
      matchHost: '.npmjs.org',
      enabled: true,
    },
],

packageRules: [
    {
      description: 'Redirect Node version datasource',
      matchDatasources: ['node-version'],
      overrideDatasource: 'docker',
      overridePackageName: 'node',
      versioning: 'node',
      extractVersion: '^(?<version>\\d+\\.\\d+\\.\\d+)$',
    },
    {
      description: 'Redirect Node version datasource (node-prebuild)',
      matchDatasources: ['github-releases'],
      matchPackageNames: ['containerbase/node-prebuild'],
      overrideDatasource: 'docker',
      overridePackageName: 'node',
      versioning: 'node',
      extractVersion: '^(?<version>\\d+\\.\\d+\\.\\d+)$',
    },
]

Without this PR:

DEBUG: Using containerbase dynamic installs (repository=felipecrs/renovate-repro-override-tool-versions, branch=renovate/lodash-monorepo)
DEBUG: Host is disabled - rejecting request. HostUrl: https://api.github.com/graphql (repository=felipecrs/renovate-repro-override-tool-versions, branch=renovate/lodash-monorepo)
 WARN: No tool releases found. (repository=felipecrs/renovate-repro-override-tool-versions, branch=renovate/lodash-monorepo)
       "toolConfig": {
         "datasource": "github-releases",
         "packageName": "containerbase/node-prebuild",
         "versioning": "node"
       }

With this PR:

DEBUG: Using containerbase dynamic installs (repository=felipecrs/renovate-repro-override-tool-versions, branch=renovate/lodash-monorepo)
DEBUG: Overriding datasource from github-releases to docker for node (repository=felipecrs/renovate-repro-override-tool-versions, branch=renovate/lodash-monorepo)
DEBUG: Overriding packageName from containerbase/node-prebuild to node for node (repository=felipecrs/renovate-repro-override-tool-versions, branch=renovate/lodash-monorepo)
DEBUG: Resolved stable matching version (repository=felipecrs/renovate-repro-override-tool-versions, branch=renovate/lodash-monorepo)
       "toolName": "node",
       "constraint": null,
       "resolvedVersion": "24.18.0"

Self-hosted admins can now redirect Containerbase tool version lookups
(e.g. github-releases/containerbase/*-prebuild) to a registry they
control, by adding packageRules to the bot/global config. Useful when
github.com is unreachable or lookups should go through a private
mirror.
@felipecrs felipecrs changed the title feat(exec): allow overriding tool version lookups via packageRules feat: allow overriding tool version lookups via global packageRules Jul 16, 2026
@jamietanna

Copy link
Copy Markdown
Member

Related: #44608 #43635 and not sure something we necessarily want to do right now, because this requires a bit more work (as install-tool itself needs to receive some of this information)

…base

A static import of applyPackageRules pulled config/options into the
manager/api load path, so generate:imports failed on a clean checkout.
@felipecrs

felipecrs commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor Author

Related: #44608 #43635

Yes, this is absolutely solving the same problem as #43635, except I'm not introducing a new option and instead I'm just reusing packageRules defined in the global config.

That is nicer because I can have a single big list of overrides in my global config, and those overrides will apply to both containerbase tool version lookups and to regular managers/datasources like node-version, java-version, etc.

A separate, exclusive option would mean I need to repeat the same overrides for both packageRules and containerbasePackageRules. I'm also avoiding adding more options lately, where sensible.


because this requires a bit more work (as install-tool itself needs to receive some of this information)

Do you mind clarifying on this, please?

PS: This is working (if not clear), and I added testing details including a reproduction in the PR description. It's marked as draft because I'm still reviewing the last bits.

@felipecrs
felipecrs marked this pull request as ready for review July 16, 2026 17:37
@github-actions
github-actions Bot requested a review from viceice July 16, 2026 17:37
@jamietanna jamietanna self-assigned this Jul 20, 2026
@jamietanna jamietanna added the maintainer-input-needed Awaiting feedback from a maintainer label Jul 20, 2026
@felipecrs

felipecrs commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor Author

#43635 addresses the same issue and I suggest we take it from there.

I'm happy to reopen it in case any maintainer prefers it.

@felipecrs felipecrs closed this Jul 20, 2026
@felipecrs
felipecrs deleted the fix/containerbase-override branch July 20, 2026 16:42
@felipecrs
felipecrs restored the fix/containerbase-override branch July 20, 2026 16:46
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Aug 20, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants