git-submodules: option to restrict updates to tags only
#43508
catostrophe
started this conversation in
Suggest an Idea
Replies: 1 comment 3 replies
|
@viceice sorry for pinging you directly. could you review the proposal? I would like to implement it. |
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Tell us more.
Summary
Allow the
git-submodulesmanager to be configured so that only tags are considered as candidate updates, ignoring branches — including branches whose names happen to look like versions.Current behaviour
The
git-submodulesmanager is hardcoded to thegit-refsdatasource:lib/modules/manager/git-submodules/index.ts—supportedDatasources = [GitRefsDatasource.id]lib/modules/manager/git-submodules/extract.ts— emitsdatasource: GitRefsDatasource.idgit-refsreturns bothheads(branches) andtags:There is no manager option to limit the lookup to tags. The
readme.mdeven states this is by design:A separate
git-tagsdatasource that filters totype === 'tags'already exists (lib/modules/datasource/git-tags/index.ts), but the manager doesn't use it.Problem
When a submodule's upstream publishes both:
v1.2.3, and2.x,release/1.2, or evenv1.2.3reused as a branch),Renovate may surface a branch as a "newer version" of the submodule, which is not what we want. We track releases by tag, and branches that happen to be named like versions should be ignored.
Workarounds today are imperfect:
allowedVersionsfilters by name, so a branch named like a version still passes.ignoreDepsrequires per-submodule maintenance and disables updates entirely.Proposed change
Add a manager option to control which ref types are considered. A couple of possible shapes:
New manager option on
git-submodules, e.g.:{ "git-submodules": { "refType": "tags" } }Valid values:
"tags"|"branches"|"any"(default:"any"for back-compat).When set to
"tags", the manager would emitdatasource: 'git-tags'(or pass a filter down togit-refs) so that onlyrefs/tags/*are considered.Alternatively, expose
git-tagsas an additional supported datasource for the manager and let users opt in viapackageRules(matchDatasources/ overrides). Less discoverable, but more flexible.Option 1 feels simplest and matches existing patterns (manager-level defaults overridable per package rule).
Back-compat
Default would remain the current behaviour (both tags and heads), so no existing setups change.
Willing to implement
Yes — happy to send a PR once the approach is approved. I'd lean toward option 1 (
refTypeon the manager config), defaulting to"any".All reactions