Open cslee00 opened 4 years ago
I started debugging, but...
Did really nothing else change in your project? Because the configuration that you posted is incorrect and should have never worked. You configure scmVersion
after the version was read, meaning customizations are ignored when reading version. Proper configuration:
// configure first
project.scmVersion {
localOnly = true
tag {
prefix = 'release'
versionSeparator = '/'
}
}
// then use
project.version = scmVersion.version
This issue was raised multiple times in the past and even has separate section in docs :)
I'm seeing the same behavior. Here's my build.gradle (its in a multi module build):
apply plugin: 'pl.allegro.tech.build.axion-release'
String getVersion(version) {
def currentRevision = "git rev-parse HEAD".execute().text
def branch = "git branch -r --contains $currentRevision".execute().text
def dVersion = (branch.contains("origin/master")) ? version : currentRevision.trim()
return dVersion
}
project.scmVersion {
tag { prefix = project.name.replaceAll('-', '_') }
versionIncrementer 'incrementMinor'
versionCreator { version, position -> getVersion(version) }
hooks { post { context -> project.version = getVersion(context.currentVersion) } }
}
project.version = project.findProperty('deployVersion') ?: scmVersion.version
git tag --points-at HEAD
cluster_autoscaler_image-0.7.0
../gradlew --version
------------------------------------------------------------
Gradle 6.8.3
------------------------------------------------------------
Build time: 2021-02-22 16:13:28 UTC
Revision: 9e26b4a9ebb910eaa1b8da8ff8575e514bc61c78
Kotlin: 1.4.20
Groovy: 2.5.12
Ant: Apache Ant(TM) version 1.10.9 compiled on September 27 2020
JVM: 11.0.9 (Oracle Corporation 11.0.9+0-adhoc..source)
OS: Linux 5.4.122 amd64
In 1.10.+:
../gradlew cV
0.7.0
In 1.11.+ / 1.12.+:
../gradlew cV
0.8.0-SNAPSHOT
Hmm - is it because the tagged commit is a merge commit?
When upgrading past 1.10.2 'currentVersion' fails to determine the correct version from the tags, as shown below. Issue exists for 1.11.0 and 1.12.0 as well, introduced in 1.10.3.
1.10.2:
1.10.3: (changing plugin on same project - no other changes)
Configuration: