-
Bug
-
Resolution: Duplicate
-
Major
-
None
-
Debian Jessie
Jenkins 2.7.2, one master + 2 SSH slaves
Pipeline plugin 2.2
Since the upgrade to Jenkins 2.7.2 & pipeline plugin 2.2, WORKSPACE is not available anymore in my groovy pipeline script.
Issue looks like https://issues.jenkins-ci.org/browse/JENKINS-36545 but since I'm a Jenkins newbie, I can't confirm they're the same.
Since shell scripts launched by pipeline use this variable, I basically can't use it anymore.
Jenkins is started with following options:
-Djava.awt.headless=true -jar /usr/share/jenkins/jenkins.war --webroot=/var/cache/jenkins/war --httpListenAddress=127.0.0.1 --httpPort=$HTTP_PORT --ajp13Port=$AJP_PORT -Dhudson.model.ParametersAction.keepUndefinedParameters=true
I first though it was somewhat related to https://wiki.jenkins-ci.org/display/SECURITY/Jenkins+Security+Advisory+2016-05-11. I tried to use default options
-Djava.awt.headless=true -jar /usr/share/jenkins/jenkins.war --webroot=/var/cache/jenkins/war --httpPort=8080
But didn't see any change.
Sample Job is as follow:
def GIT_HOSTNAME='ci.jbfav.re' def GIT_REPO_NAME='redis' // Checkout package git repository // Must be done on master (my setup) node('master'){ deleteDir() stage('Build source package') withEnv([ "release=${release}", "branch=${branch}", "tag=${tag}", "distribution=${distribution}", ]) { sh 'env' } } // Build binary packages // Can be done on slave if no dependencies from APT repository // Must be done on master if apt repository needed (PHP extensions for example) stage name: 'Build binary packages' parallel architecture_i386: { node('slave'){ def architecture='i386' deleteDir() withEnv([ "release=${release}", "branch=${branch}", "tag=${tag}", "distribution=${distribution}", "architecture=${architecture}", "BUILD_ONLY=true", "SUDO_CMD=sudo", ]) { sh 'env' } } }, architecture_amd64: { node('slave'){ def architecture='amd64' deleteDir() withEnv([ "release=${release}", "branch=${branch}", "tag=${tag}", "distribution=${distribution}", "architecture=${architecture}", "BUILD_ONLY=true", "SUDO_CMD=sudo", ]) { sh 'env' } } } // Add source & binaries packages to APT repository // Must be done on master (my setup) node('master'){ stage('Add packages to APT repository') deleteDir() withEnv([ "release=${release}", "branch=${branch}", "tag=${tag}", "distribution=${distribution}", "PROVIDE_ONLY=true", "REPO_CODENAME=${distribution}", "BASE_PATH=.", "RELEASE_DISTRIBUTION=${distribution}" ]) { sh 'env' } stage('Sync local APT repository on AWS S3') withEnv([ "release=${release}", ]) { sh 'env' } }
- duplicates
-
JENKINS-33511 env.WORKSPACE should be available within node{} in Pipeline
-
- Resolved
-