allegro / axion-release-plugin

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

CurrentVersion is returning old version #846

Open danshinton opened 2 weeks ago

danshinton commented 2 weeks ago

The plugin was working just fine until this release. Now it returning the wrong version. Here is the output of git tag:

1.0.0
1.1.0
1.1.0-SNAPSHOT
1.2.0
1.2.0-SNAPSHOT
1.3.0
1.3.0-SNAPSHOT
1.4.0
1.4.0-SNAPSHOT
1.5.0
1.5.0-SNAPSHOT
1.6.0
1.6.0-SNAPSHOT
1.7.0-SNAPSHOT

When executing gradle currentVersion I would expect it to return 1.7.0-SNAPSHOT. Instead it returns:

Project version: 1.6.0

This means when trying to do a release it says:

Working on released version 1.6.0, nothing to release

Relevant Gradle config:

plugins {
    id("pl.allegro.tech.build.axion-release").version("1.18.13")
}

scmVersion {
    useHighestVersion()
    tag {
        initialVersion({ _, _ -> "1.0.0" })
        prefix = ""
    }
    nextVersion {
        suffix.set("SNAPSHOT")
        separator.set("-")
    }
    versionIncrementer("incrementMinor")
    repository {
        pushTagsOnly.set(true)
        remote.set(System.getenv("CI_SERVER_URL") + "/" + System.getenv("CI_PROJECT_NAMESPACE") + "/" + System.getenv("CI_PROJECT_NAME") + ".git")
    }
}

How can I go about troubleshooting this?

danshinton commented 2 weeks ago

To add some more information:

If I remove 1.6.0, it correctly says 1.6.0-SNAPSHOT and creates a 1.6.0 release. If I remove everything but the following:

1.6.0
1.6.0-SNAPSHOT
1.7.0-SNAPSHOT

It's broke again. If I add 1.7.0 and 1.8.0-SNAPSHOT, it claims the current version is 1.7.0. So I'm not sure why the behavior of the plugin changes once you get to 1.7.0-SNAPSHOT.

bgalek commented 2 weeks ago

Hi, we will look into it. @radoslaw-panuszewski I think its do the tags filtering, we need to update the filter

bgalek commented 2 weeks ago

@danshinton In the example you provided, do you have any commits after 1.6.0? Maybe your tags are on the same commit? It would be perfect if you would prepare a repository that shows the issue.

danshinton commented 2 weeks ago

So when I created this ticket, if I create a repo and just called release -Prelease.disableChecks -Prelease.pushTagsOnly and markNextVersion over and over, it worked until 1.6.0 is released. I would use git fetch --prune --prune-tags to reset my local repo to test again.

This morning, it is working for some reason. So there must be some transient condition which is not triggering now.