Working with git-flow
Closed this issue · 5 comments
Hi,
I'm trying to see if your plugin works with 'git flow'? I set a simple git/git-flow/gradle test with gradle 4.2, and versioning 2.6.1. It doesn't looks like it picks up the last tag?
$ cat build.gradle
plugins {
id "net.nemerosa.versioning" version "2.6.1"
}
version = versioning.info.display
println "full: " + versioning.info.full
println "display: " + versioning.info.display
println "version: " + project.version
$ git tag --list
1.0.0
$ ./gradlew versionDisplay
> Configure project :
full: develop-7c76a87
display: develop-7c76a87
version: develop-7c76a87
> Task :versionDisplay
[version] scm = git
[version] branch = develop
[version] branchType = develop
[version] branchId = develop
[version] commit = 7c76a872f6356166698b5a7c38a95f6262e36791
[version] full = develop-7c76a87
[version] base =
[version] build = 7c76a87
[version] display = develop-7c76a87
[version] tag =
[version] dirty = false
Only release/
branches will have their version being computed according to the tags. Other branches, like master
or feature/
, do not use tags. You can change this behaviour by setting the releases
configuration parameter. It is set by default to:
versioning {
releases = ['release']
}
If it does make sense for you to compute versions from tags in a develop
branch, you can use, for example:
versioning {
releases = ['release', 'develop']
}
Thank you for that. I see how that works now. I shouldn't have assumed that the "last" tag in history would win.
git log --pretty --oneline
78310cc (HEAD -> develop) empty
b45823a (tag: 1.1.0) empty
7c76a87 test1
bd82f26 (tag: 1.0.0) added gitignore
ef6a48f initial
226134c (master) Initial commit
$ ./gradlew versionDisplay
> Configure project :
full: develop-78310cc
display: develop-78310cc
version: develop-78310cc
> Task :versionDisplay
[version] scm = git
[version] branch = develop
[version] branchType = develop
[version] branchId = develop
[version] commit = 78310cc4248da151b2115808a834fc4b5fd74501
[version] full = develop-78310cc
[version] base =
[version] build = 78310cc
[version] display = develop-78310cc
[version] tag =
[version] dirty = false
$ git tag 1.1.1
$ ./gradlew versionDisplay
> Configure project :
full: develop-78310cc
display: develop-78310cc
version: develop-78310cc
> Task :versionDisplay
[version] scm = git
[version] branch = develop
[version] branchType = develop
[version] branchId = develop
[version] commit = 78310cc4248da151b2115808a834fc4b5fd74501
[version] full = develop-78310cc
[version] base =
[version] build = 78310cc
[version] display = develop-78310cc
[version] tag = 1.1.1
[version] dirty = false
If I stop at the "tag" commit then it does show it.
There are many options available to configure fully the behaviour.
The default behaviour just reflects the way I deal with versioning, where I do not want to tag in advance, only after the CD chain has succeeded, and only for release branches.
So, feel free to configure the versioning plugin as you see fir in your context :)
Is there anything else to do for this issue?
BR
Damien
oh great. Is there any more documentation on how to take advantage of the different configuration options? All good on this issue.
All the documentation is available in the root page of this repository.