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

Configurable next-version strategies and mode #1839

Closed
erikbra opened this issue Oct 2, 2019 · 7 comments · Fixed by #3883
Closed

Configurable next-version strategies and mode #1839

erikbra opened this issue Oct 2, 2019 · 7 comments · Fixed by #3883
Labels
Milestone

Comments

@erikbra
Copy link
Contributor

erikbra commented Oct 2, 2019

Running GitVersion, most of the time running, which can be quite long on large-ish codebases, is spent on looping through all version candidates on all versioning strategies on the codebase.

This includes traversing backwards using:

  • FallbackBaseVersionStrategy
  • ConfigNextVersionBaseVersionStrategy,
  • TaggedCommitVersionStrategy
  • MergeMessageBaseVersionStrategy
  • VersionInBranchNameBaseVersionStrategy
  • TrackReleaseBranchesVersionStrategy

Some of these are rather expensive. On our codebase at work, a lot of time is spent in MergeMessageBaseVersionStrategy. I don't think we need this, as we use tag-based versioning. We would benefit a lot being able to enable just the versioning strategy desired, alternatively a list of strategies. Not all strategies are applicable for everyone.

So, 1st suggestion is:

Making the strategies used configurable

2nd, I'd like to question if it is really necessary to loop through all previous commits in parents to find the "largest version" candidate. I am very open to being wrong here, but wouldn't the newest version found be the correct one to use for calculating the next version in 99% of all cases? At least, there could be a configurable setting to make it use the first/newest ancestor version on each strategy.

2nd suggestion is, then:

Make a config switch available to always use the newest version when calculating next

I'd be happy to take on this task, but I might need a little guidance on where I should put the new config values. Does it make sense to put them on the branch? Or globally?

I have attached a run of GitVersion of a codebase I am working on. In all strategies, it finds the correct version to use for calculating "next version" (2019.21.0) in the first try. First is after 3 secs. But it still loops through all commits in all strategies, and takes and additional 60secs (30 after my other #1838). I'd like it to stop after finding the first candidate for a strategy.

gitversion-diag.txt

@asbjornu
Copy link
Member

asbjornu commented Oct 5, 2019

I like your ideas. With "newest" version, are you thinking of not having to look at older commits once we've found a version number? How would we know whether potential branches involved in potential versioning strategies don't contain newer (or older) commits yielding a higher version number than the (first) one we've found?

Could you make an example of how the config value might look like so I get a better idea of what you're thinking of?

@stale
Copy link

stale bot commented Jan 3, 2020

This issue has been automatically marked as stale because it has not had recent activity. After 30 days from now, it will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jan 3, 2020
@asbjornu
Copy link
Member

asbjornu commented Jan 3, 2020

@erikbra, have you had any time to think about this? If so, could you please make a proposal for your suggested config switch?

@stale stale bot removed the stale label Jan 3, 2020
@erikbra
Copy link
Contributor Author

erikbra commented Jan 8, 2020

@asbjornu Sorry, I just haven't had any more time to look at this yet... don't want to suggest anything before having looked more at it... please, everyone, feel free to chip in ideas :)

@stale
Copy link

stale bot commented Apr 7, 2020

This issue has been automatically marked as stale because it has not had recent activity. After 30 days from now, it will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Apr 7, 2020
@stale stale bot closed this as completed May 7, 2020
@HHobeck HHobeck added this to the 6.x milestone Jan 28, 2024
@HHobeck HHobeck reopened this Jan 28, 2024
@HHobeck HHobeck added feature and removed stale labels Jan 28, 2024
@erikbra
Copy link
Contributor Author

erikbra commented Mar 3, 2024

Just wanted to thank @asbjornu and @HHobeck for working on this, even though I haven't contributed at all here since I reported it. Great work!!

@arturcic arturcic modified the milestones: 6.x, 6.0.0-beta.6 Mar 9, 2024
@arturcic
Copy link
Member

arturcic commented Mar 9, 2024

🎉 This issue has been resolved in version 6.0.0-beta.6 🎉
The release is available on:

Your GitReleaseManager bot 📦🚀

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

Successfully merging a pull request may close this issue.

4 participants