Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(managers/git-submodules): support updating git-tag versions #30104

Merged
merged 6 commits into from
Jul 26, 2024

Conversation

Shegox
Copy link
Contributor

@Shegox Shegox commented Jul 9, 2024

This PR introduces support for updating git submodules using versioned git tags. This enhancement is useful for updating submodules to follow specific releases (i.e., tags) rather than tracking a particular branch, such as the main branch of a downstream repository.

Additionally, it changes the versioning scheme from git-refs to semver if the current branch value matches a valid semver format.

Context

Previously, Renovate already supported updating submodules via manual adjustments:

  • required to change the versioning to semver
  • and the value in the .gitmodules file wasn't updated automatically. (could be overcome with a RegexManager)

fixes #14258
fixes #24827

Inspired by the fork from @pl4nty (#24827 (comment))

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

Demo Repository: https://github.com/Shegox/renovate-submodule-parent
Demo Pull Request: Shegox/renovate-submodule-parent#1

lib/modules/manager/git-submodules/artifacts.ts Outdated Show resolved Hide resolved
lib/modules/manager/git-submodules/artifacts.ts Outdated Show resolved Hide resolved
lib/modules/manager/git-submodules/extract.ts Outdated Show resolved Hide resolved
lib/modules/manager/git-submodules/readme.md Outdated Show resolved Hide resolved
lib/modules/manager/git-submodules/update.ts Show resolved Hide resolved
@Shegox Shegox requested a review from viceice July 9, 2024 19:33
@DanySK
Copy link
Contributor

DanySK commented Jul 10, 2024

@Shegox, once merged, how will this work? I am very interested in using it ASAP

Edit: I mean, will this require any additional configuration, or setting a tag name into the branch entry of .gitmodule will suffice?

@Shegox
Copy link
Contributor Author

Shegox commented Jul 10, 2024

Edit: I mean, will this require any additional configuration, or setting a tag name into the branch entry of .gitmodule will suffice?

This should suffice, if your submodule has a standard semver tag versioning and you don't need any other special Renovate magic.
For my use case the full configuration in the renovate.json just enables the git-submodules manager and thats it

{
  "git-submodules": {
    "enabled": true
  }
}

And then my .gitmodules references the tag as branch:

[submodule "deps/renovatebot"]
	path = deps/renovatebot
	url = https://github.com/renovatebot/renovate.git
	branch = 37.425.0

This will then create an update PR like this:

image image

@DanySK You can as well see the demo repository here: https://github.com/Shegox/renovate-submodule-parent (Update PR: Shegox/renovate-submodule-parent#1)

@DanySK

This comment has been minimized.

@Shegox Shegox requested a review from viceice July 10, 2024 11:23
@rarkins rarkins enabled auto-merge July 10, 2024 16:39
@pl4nty
Copy link
Contributor

pl4nty commented Jul 15, 2024

@Shegox thanks for this, I'm looking forward to testing it! Would you mind adding Co-authored-by: Tom Plant <tom@tplant.com.au> to 34ca381?

Shegox and others added 2 commits July 15, 2024 17:04
Co-authored-by: Tom Plant <tom@tplant.com.au>
@rarkins rarkins added this pull request to the merge queue Jul 26, 2024
@viceice viceice requested a review from secustor July 26, 2024 07:04
Merged via the queue into renovatebot:main with commit ba7a39d Jul 26, 2024
38 checks passed
@renovate-release
Copy link
Collaborator

🎉 This issue has been resolved in version 38.6.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants