From 15c418e9b64dd9ecb56842a1e574e4ca63b16e84 Mon Sep 17 00:00:00 2001 From: Carl Kittelberger Date: Fri, 21 Apr 2017 02:43:44 +0200 Subject: [PATCH] Jenkinsfile: Fix UPX not available in PATH error. --- Jenkinsfile | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 164c2c2..9ee3a19 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,26 +9,26 @@ def binext(os) { def upx(file) { // Install upx - tool "UPX v3.91" - - switch("${env.GOOS}.${env.GOARCH}") { - case "linux.amd64": - case "linux.386": - case "darwin.amd64": - case "darwin.arm": - case "windows.amd64": - case "windows.386": - case "freebsd.386": - case "netbsd.386": - if (env.GOOS == "linux") { - sh "GOOS= GOARCH= go get -v github.com/pwaller/goupx" - sh "goupx --no-upx \"$file\"" - } - sh "upx --best --ultra-brute \"$file\"" - break - default: - echo "Skipping UPX compression as it is not supported for $goos/$goarch." - break + withEnv(["PATH+=${tool "UPX v3.91"}"]) { + switch("${env.GOOS}.${env.GOARCH}") { + case "linux.amd64": + case "linux.386": + case "darwin.amd64": + case "darwin.arm": + case "windows.amd64": + case "windows.386": + case "freebsd.386": + case "netbsd.386": + if (env.GOOS == "linux") { + sh "GOOS= GOARCH= go get -v github.com/pwaller/goupx" + sh "goupx --no-upx \"$file\"" + } + sh "upx --best --ultra-brute \"$file\"" + break + default: + echo "Skipping UPX compression as it is not supported for $goos/$goarch." + break + } } }