mirror of
https://github.com/GTNewHorizons/Postea.git
synced 2026-11-18 19:39:35 +00:00
Fix a NPE when checking the version in releases/jenkins (#199)
* Fix a NPE when checking the version in releases/jenkins * Be safe with the last tag too * Nicer text for missing branch info on Jenkins * Try GIT_LOCAL_BRANCH from the jenkins git plugin before giving up * Use the working Jenkins env variable
This commit is contained in:
1 parent
8d854ef526
commit
f61fedf9f2
1 file changed
+5
-2
+5
-2
@@ -363,9 +363,12 @@ try {
|
||||
if (versionOverride == null) {
|
||||
def gitDetails = versionDetails()
|
||||
def isDirty = gitVersion().endsWith(".dirty") // No public API for this, isCleanTag has a different meaning
|
||||
String branchName = gitDetails.branchName
|
||||
String branchName = gitDetails.branchName ?: (System.getenv('GIT_BRANCH') ?: 'git')
|
||||
if (branchName.startsWith('origin/')) {
|
||||
branchName = branchName.minus('origin/')
|
||||
}
|
||||
branchName = branchName.replaceAll("[^a-zA-Z0-9-]+", "-") // sanitize branch names for semver
|
||||
identifiedVersion = gitDetails.lastTag
|
||||
identifiedVersion = gitDetails.lastTag ?: '${gitDetails.gitHash}'
|
||||
if (gitDetails.commitDistance > 0) {
|
||||
identifiedVersion += "-${branchName}.${gitDetails.commitDistance}+${gitDetails.gitHash}"
|
||||
if (isDirty) {
|
||||
|
||||
Reference in new issue
Block a user