You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying to create a template repository for teams to create projects from and I'm finding that the describe.tag doesn't quite work with the placeholder default values functionality.
My configuration
version = '0.0.0-SNAPSHOT'
gitVersioning.apply {
refs {
considerTagsOnBranches = true
tag('v(?<version>.*)') {
version = '${ref.version}'
}
branch('main') {
version = '${describe.tag.version.major:-0}.${describe.tag.version.minor:-0}.${describe.tag.version.patch.next:-0}-SNAPSHOT'
}
branch('.+') {
version = '${describe.tag:-0.0.0}-${describe.distance:-1}-SNAPSHOT'
}
}
}
If there are no tags currently, this will work fine for the main branch, but I've discovered that describe.tag will return root instead of being replaced with 0.0.0. It seems like it should allow for the placeholder to take over here rather than always returning root in this case. Perhaps that was necessary before the placeholders functionality was available?
My work around is to use the following since it isn't an issue once you try to access the describe.tag.version:
version = '0.0.0-SNAPSHOT'
gitVersioning.apply {
refs {
considerTagsOnBranches = true
tag('v(?<version>.*)') {
version = '${ref.version}'
}
branch('main') {
version = '${describe.tag.version.major:-0}.${describe.tag.version.minor:-0}.${describe.tag.version.patch.next:-0}-SNAPSHOT'
}
branch('.+') {
version = '${describe.tag.version}-${describe.distance:-1}-SNAPSHOT'
}
}
}
So perhaps just a documentation note indicating that describe.tag will always return some value once the repository is not shallow?
Additionally this still breaks when the clone is shallow, and will result in the following:
* What went wrong:
A problem occurred evaluating root project 'develop-java-library-workflows'.
> java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.IllegalStateException: couldn't find matching tag in shallow git repository
This certainly makes sense if there were no default placeholders, and it's definitely useful to emit that no tag could be found in a shallow git repository, but it feels that with the placeholder with a default value defined that it should gracefully accept the default value instead?
This is mostly an issue with github actions/checkout and reusable workflows where not expecting to do full clones by default, nor is it straight forward to pass env vars to reusable workflows either.
For the moment I'll look at disabling or trying to make those unshallow, though I might try and automatically unshallow a clone with some scripting before the plugin applies.
The text was updated successfully, but these errors were encountered:
Trying to create a template repository for teams to create projects from and I'm finding that the describe.tag doesn't quite work with the placeholder default values functionality.
My configuration
If there are no tags currently, this will work fine for the main branch, but I've discovered that
describe.tag
will returnroot
instead of being replaced with0.0.0
. It seems like it should allow for the placeholder to take over here rather than always returningroot
in this case. Perhaps that was necessary before the placeholders functionality was available?My work around is to use the following since it isn't an issue once you try to access the
describe.tag.version
:So perhaps just a documentation note indicating that
describe.tag
will always return some value once the repository is not shallow?Additionally this still breaks when the clone is shallow, and will result in the following:
This certainly makes sense if there were no default placeholders, and it's definitely useful to emit that no tag could be found in a shallow git repository, but it feels that with the placeholder with a default value defined that it should gracefully accept the default value instead?
This is mostly an issue with github actions/checkout and reusable workflows where not expecting to do full clones by default, nor is it straight forward to pass env vars to reusable workflows either.
For the moment I'll look at disabling or trying to make those unshallow, though I might try and automatically unshallow a clone with some scripting before the plugin applies.
The text was updated successfully, but these errors were encountered: