-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
Jenkins Version: 1.609.1
Plugin Version: 1.5.1 (previously installed version was 1.3)
The environment variables of the host system aren't passed to the docker container anymore. This behaviour has changed since the last updates of the plugin, because it worked in a previous version.
Example output with plugin version 1.3:
[sbs-admin-trunk] $ docker exec --tty 22f4b8d78b817a1cf73d0e5ab48cab31d65de4b3b2db01d1388e809a135cd36e /bin/sh -xe /tmp/hudson7758699465236749562.sh + env JENKINS_HOME=/export/sbs/jenkins/home USER=jenkins HOSTNAME=22f4b8d78b81 GIT_COMMIT=21c329e0976c10e935e3ad33b60fa0b3e446b581 LD_LIBRARY_PATH=/export/build/sbs/packages/linux/svn-1.7/lib: NODE_LABELS=64bit android-sdk berlin cloud docker linux linux-cloud-078 ubuntu ubuntu-14.04 HOME=/home/jenkins PATH+JDK=/export/build/jenkins-localfs/tools/hudson.model.JDK/jdk-1.7.0_latest_/bin JENKINS_SERVER_COOKIE=132c0177868555ac WORKSPACE=/export/build/jenkins-localfs/workspace/sbs-admin-trunk LOGNAME=jenkins NODE_NAME=linux-cloud-078 TERM=xterm HUDSON_HOME=/export/sbs/jenkins/home PATH=/export/build/sbs/packages/linux/svn-1.7/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games BUILD_ID=29 BUILD_TAG=jenkins-sbs-admin-trunk-29 JENKINS_URL=https://... GIT_URL=https://... JOB_URL=https://... BUILD_NUMBER=29 SHELL=/bin/bash JOB_NAME=sbs-admin-trunk JAVA_HOME=/export/build/jenkins-localfs/tools/hudson.model.JDK/jdk-1.7.0_latest_ PWD=/export/build/jenkins-localfs/workspace/sbs-admin-trunk GIT_PREVIOUS_COMMIT=21c329e0976c10e935e3ad33b60fa0b3e446b581 (and some more...) [sbs-admin-trunk] $ docker exec --tty 22f4b8d78b817a1cf73d0e5ab48cab31d65de4b3b2db01d1388e809a135cd36e /export/build/jenkins-localfs/tools/hudson.tasks.Maven_MavenInstallation/maven-3.2.x/bin/mvn -f pom.xml -U -e install -DskipTests exec: "/export/build/jenkins-localfs/tools/hudson.tasks.Maven_MavenInstallation/maven-3.2.x/bin/mvn": stat /export/build/jenkins-localfs/tools/hudson.tasks.Maven_MavenInstallation/maven-3.2.x/bin/mvn: no such file or directory Build step 'Invoke top-level Maven targets' marked build as failure Stopping Docker container after build completion
The same job execution with plugin version 1.5.1:
[sbs-admin-trunk] $ docker exec --tty --user 5003: ded99d09fec98ff198d27c448abd03fe68eb3f62dca060ee4f23285c21513f91 /bin/sh -xe /tmp/hudson5039313317665547776.sh
+ env
HOSTNAME=ded99d09fec9
HOME=/
TERM=xterm
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PWD=/export/build/jenkins-localfs/workspace/sbs-admin-trunk
[sbs-admin-trunk] $ docker exec --tty --user 5003: ded99d09fec98ff198d27c448abd03fe68eb3f62dca060ee4f23285c21513f91 /export/build/jenkins-localfs/tools/hudson.tasks.Maven_MavenInstallation/maven-3.2.x/bin/mvn -f pom.xml -U -e install -DskipTests
Error: JAVA_HOME is not defined correctly.
We cannot execute
Build step 'Invoke top-level Maven targets' marked build as failure
Stopping Docker container after build completion
As you can see, the environment parameters aren't set within the docker container anymore. This influences jobs that rely on specific environment settings as well as the auto installation mechanism of jenkins that uses environment variables in order to set the path of the specified tool versions (for example JAVA_HOME).