allegro / axion-release-plugin

Gradle release & version management plugin.
https://axion-release-plugin.readthedocs.io/
Apache License 2.0
560 stars 154 forks source link

[Feature / suggestion] Print warning when no prior version is detected #826

Open ddeath opened 3 weeks ago

ddeath commented 3 weeks ago

I saw it couple times in our project, sometimes the plugin probably does not detect any tag or something and it will create default initial version of 0.1.0 even though there are 10 prior tags. This is happening on Gitlab CI pipeline.

I found the issue. Basically default behavior of Gitlab is that it will fetch (not clone) repository and on top of that only top 20 commits. So if you have maybe monorepo, or for some any other reason you didnt release in last 20 commits, axion will not find any tag tight to those commits and will assume this is the first release and will use 0.1.0 version. Above situation will usually result in error:

remote status: REJECTED_NONFASTFORWARD
remote message: 
> Task :release FAILED

Because axion will try to push tag 0.1.0 but it already exists.

This was kind of hard to debug therefore I would suggest to print Didn't detect any previous version in available git history, treating it as new release which will get more explicit hint to the developer.

Ideally I would add some debug / verbose mode where plugin would also tags it sees and then all matching tags etc...

tomasz-pankowski-allegro commented 1 week ago

spojrzę na to zadanie w ramach hacktoberfest

tomasz-pankowski-allegro commented 1 week ago

PR: https://github.com/allegro/axion-release-plugin/pull/844