From 0aa7411d02380223046a9b55ad38eee8c64b84f6 Mon Sep 17 00:00:00 2001 From: Konicai <71294714+Konicai@users.noreply.github.com> Date: Thu, 15 Sep 2022 20:32:38 -0400 Subject: [PATCH] Fix git branch on Jenkins (#3286) --- core/build.gradle.kts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/build.gradle.kts b/core/build.gradle.kts index f2225dbb8..0d1c16825 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -79,7 +79,8 @@ configure { val indra = the() val mainFile = "src/main/java/org/geysermc/geyser/GeyserImpl.java" - val branchName = indra.branchName() ?: "DEV" + // On Jenkins, a detached head is checked out, so indra cannot determine the branch. Fortunately, this environment variable is available. + val branchName = indra.branchName() ?: System.getenv("GIT_BRANCH") ?: "DEV" val commit = indra.commit() val git = indra.git() val gitVersion = "git-${branchName}-${commit?.name?.substring(0, 7) ?: "0000000"}" @@ -93,4 +94,4 @@ configure { } fun Project.buildNumber(): Int = - Integer.parseInt(System.getenv("BUILD_NUMBER") ?: "-1") \ No newline at end of file + Integer.parseInt(System.getenv("BUILD_NUMBER") ?: "-1")