I hate Jenkins sometimes

This commit is contained in:
Telesphoreo 2022-04-22 03:04:10 -05:00
parent d495d26d78
commit da8e9e0497
2 changed files with 15 additions and 4 deletions

2
Jenkinsfile vendored
View File

@ -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')

View File

@ -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<JavaExec> = register<JavaExec>(name) {