axion-release-plugin
axion-release-plugin copied to clipboard
[Feature / suggestion] Print warning when no prior version is detected
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.0even 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...
spojrzę na to zadanie w ramach hacktoberfest
PR: https://github.com/allegro/axion-release-plugin/pull/844
Please update the GitLab CI example in the documentation. I was running into this issue also.
https://axion-release-plugin.readthedocs.io/en/latest/configuration/ci_servers/#gitlab-ci
Adding GIT_STRATEGY and GIT_DEPTH resolved the problem for me.
https://docs.gitlab.com/ee/ci/runners/configure_runners.html#git-strategy
https://docs.gitlab.com/ee/ci/runners/configure_runners.html#shallow-cloning
Also was running into an issue where tags were missing in GitLab.
So the latest release tag was not being detected correctly.
I had to add an additional fetch to get the missing tags.
variables:
GIT_STRATEGY: clone
GIT_DEPTH: 0
script:
- git fetch --prune --prune-tags
...