From da8e9e0497e683bffe16bf51b2c324880588c5d9 Mon Sep 17 00:00:00 2001 From: Telesphoreo Date: Fri, 22 Apr 2022 03:04:10 -0500 Subject: [PATCH] I hate Jenkins sometimes --- Jenkinsfile | 2 +- patches/server/0001-Build-changes.patch | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9e0c043..06da1f6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,7 +1,7 @@ pipeline { agent any environment { - BRANCH_NAME = "${GIT_BRANCH.split('/').size() > 1 ? GIT_BRANCH.split('/')[1..-1].join('/') : GIT_BRANCH}" + GITHUB_BRANCH = "${GIT_BRANCH.split('/').size() > 1 ? GIT_BRANCH.split('/')[1..-1].join('/') : GIT_BRANCH}" } options { buildDiscarder logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '', numToKeepStr: '5') diff --git a/patches/server/0001-Build-changes.patch b/patches/server/0001-Build-changes.patch index c311d61..9ad3ec9 100644 --- a/patches/server/0001-Build-changes.patch +++ b/patches/server/0001-Build-changes.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Build changes diff --git a/build.gradle.kts b/build.gradle.kts -index dd8f449dddbe0838835ae8f8d5033aa422db403d..20120bd0b031d5106968c8bf7516b3db23e74ab7 100644 +index dd8f449dddbe0838835ae8f8d5033aa422db403d..4567cfddf92b21e5421c4f5596d754b0d3a2ca9f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -9,8 +9,8 @@ plugins { @@ -19,7 +19,18 @@ index dd8f449dddbe0838835ae8f8d5033aa422db403d..20120bd0b031d5106968c8bf7516b3db // Paper start implementation("org.jline:jline-terminal-jansi:3.21.0") implementation("net.minecrell:terminalconsoleappender:1.3.0") -@@ -59,7 +59,7 @@ tasks.jar { +@@ -55,11 +55,17 @@ tasks.jar { + val gitHash = git("rev-parse", "--short=7", "HEAD").getText().trim() + val implementationVersion = System.getenv("BUILD_NUMBER") ?: "\"$gitHash\"" + val date = git("show", "-s", "--format=%ci", gitHash).getText().trim() // Paper +- val gitBranch = git("rev-parse", "--abbrev-ref", "HEAD").getText().trim() // Paper ++ var gitBranch: String; ++ if (System.getenv("JENKINS_URL") == null) ++ { ++ gitBranch = git("rev-parse", "--abbrev-ref", "HEAD").getText().trim() // Paper ++ } else { ++ gitBranch = System.getenv("GITHUB_BRANCH") ++ } attributes( "Main-Class" to "org.bukkit.craftbukkit.Main", "Implementation-Title" to "CraftBukkit", @@ -28,7 +39,7 @@ index dd8f449dddbe0838835ae8f8d5033aa422db403d..20120bd0b031d5106968c8bf7516b3db "Implementation-Vendor" to date, // Paper "Specification-Title" to "Bukkit", "Specification-Version" to project.version, -@@ -147,7 +147,7 @@ fun TaskContainer.registerRunTask( +@@ -147,7 +153,7 @@ fun TaskContainer.registerRunTask( name: String, block: JavaExec.() -> Unit ): TaskProvider = register(name) {