From 62aefc3e52de671fdb08b330effcce2756a9473a Mon Sep 17 00:00:00 2001 From: Hyatt Date: Sun, 28 Nov 2021 00:36:06 +0000 Subject: [PATCH] Update 'build-minecraft.jenkins' --- build-minecraft.jenkins | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/build-minecraft.jenkins b/build-minecraft.jenkins index 0ee738e..1c67a70 100644 --- a/build-minecraft.jenkins +++ b/build-minecraft.jenkins @@ -34,6 +34,12 @@ spec: tty: true command: - /busybox/cat + - name: alpine + image: ${repository}/library/alpine:latest + imagePullPolicy: Always + tty: true + command: + - /bin/sh """) { node (nodeLabel) { // Set working directory @@ -88,12 +94,21 @@ CMD cd data; java -Xms${memoryMin} -Xmx${memoryMax} -jar ../paper-mc.jar } stage ("Build & Push") { + container ("alpine") { + sh "apk add --no-cache curl jq" + paperDownload = sh ( + script: """ + paperBuild=\$(curl --silent --location --fail https://papermc.io/api/v2/projects/paper/versions/${paperVersion} | jq '.builds | max') + paperFile=\$(curl --silent --location --fail https://papermc.io/api/v2/projects/paper/versions/${paperVersion}/builds/\${paperBuild} | jq '.downloads.application.name') + echo https://papermc.io/api/v2/projects/paper/versions/${paperVersion}/builds/\${paperBuild}/downloads/\${paperFile} + """ + returnStdout: true + ).trim() + } + container ("kaniko") { sh """ - paperBuild=\$(curl --silent --location --fail https://papermc.io/api/v2/projects/paper/versions/${paperVersion} | jq '.builds | max') - paperFile=\$(curl --silent --location --fail https://papermc.io/api/v2/projects/paper/versions/${paperVersion}/builds/\${paperBuild} | jq '.downloads.application.name') - paperDownload="https://papermc.io/api/v2/projects/paper/versions/${paperVersion}/builds/\${paperBuild}/downloads/\${paperFile}" - /kaniko/executor --cleanup --context "${workspace}" -f "${workspace}/Dockerfile" --destination "${repository}/library/minecraft:latest" --build-arg "paperDownload=\${paperDownload}" + /kaniko/executor --cleanup --context "${workspace}" -f "${workspace}/Dockerfile" --destination "${repository}/library/minecraft:latest" --build-arg "paperDownload=${paperDownload}" """ } }