Empty environment variables are deleted. Three methods tried:
1. Parameter
2. Generate environment variables from script
3. Inject environment variables to the build process
As can be seen from the log below, the non-empty variables MYVAR1, MYVAR3 & MYVAR5 works as expected, but the empty variables MYVAR2, MYVAR4 & MYVAR6 are not present in the environment when the job executes.
When looking at the enviroment through the left hand menu "Environment Variables" on the build page all variables are present. You can actually also see that an implicit environment varable TEST_NODE are also deleted.
I'm not that the problem is in EnvInject. Feel free to move it to some other component.
Looks similar to JENKINS-15146.
log:
Started by user magjac
[EnvInject] - Loading node environment variables.
Building on master in workspace /srv/lhome/jenkins/jobs/empty_env_var_test/workspace
[workspace] $ /bin/sh -xe /tmp/empty_env_var_test6599764777552559363.sh
+ echo MYVAR3=world
+ echo MYVAR4=
[environment-script] Adding variable 'MYVAR4' with value ''
[environment-script] Adding variable 'MYVAR3' with value 'world'
[EnvInject] - Executing scripts and injecting environment variables after the SCM step.
[EnvInject] - Injecting as environment variables the properties content
MYVAR5=foo
MYVAR6=
[EnvInject] - Variables injected successfully.
[workspace] $ /bin/sh -xe /tmp/hudson101371634758484537.sh
+ env
JENKINS_HOME=/srv/lhome/jenkins
MAIL=/var/mail/smoker
USER=smoker
LC_TIME=en_DK.UTF-8
MYVAR1=hello
SHLVL=1
NODE_LABELS=master master_label null
HUDSON_URL=http://smoketest.netinsight.se/jenkins/
LD_LIBRARY_PATH=/usr/lib/jvm/java-6-openjdk-amd64/jre/lib/amd64/server:/usr/lib/jvm/java-6-openjdk-amd64/jre/lib/amd64:/usr/lib/jvm/java-6-openjdk-amd64/jre/../lib/amd64
MYVAR3=world
HOME=/home/smoker
BUILD_URL=http://smoketest.netinsight.se/jenkins/job/empty_env_var_test/6/
MYVAR5=foo
JENKINS_SERVER_COOKIE=dad1862e4df27e29
HUDSON_COOKIE=0cebdd7b-7b7f-4962-a07c-c1dc9a842ca6
LC_CTYPE=sv_SE.UTF-8
WORKSPACE=/srv/lhome/jenkins/jobs/empty_env_var_test/workspace
LOGNAME=smoker
BUILD_CAUSE=MANUALTRIGGER
_=/usr/bin/daemon
EXECUTOR_NUMBER=380
TERM=rxvt
BUILD_DISPLAY_NAME=#6
LC_COLLATE=sv_SE.UTF-8
HUDSON_HOME=/srv/lhome/jenkins
PATH=/home/smoker/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
BUILD_ID=2014-08-15_11-35-11
BUILD_TAG=jenkins-empty_env_var_test-6
DISPLAY=worabu.netinsight.se:0.0
JENKINS_URL=http://smoketest.netinsight.se/jenkins/
PYTHONUSERBASE=/home/smoker/.local
LANG=C
JOB_URL=http://smoketest.netinsight.se/jenkins/job/empty_env_var_test/
BUILD_NUMBER=6
NODE_PATH=/usr/lib/nodejs:/usr/lib/node_modules:/usr/share/_javascript_
SHELL=/bin/bash
HUDSON_SERVER_COOKIE=dad1862e4df27e29
LC_MEASUREMENT=sv_SE.UTF-8
JOB_NAME=empty_env_var_test
PWD=/srv/lhome/jenkins/jobs/empty_env_var_test/workspace
LC_NUMERIC=sv_SE.UTF-8
LC_PAPER=sv_SE.UTF-8
BUILD_CAUSE_MANUALTRIGGER=true
Finished: SUCCESS
menu "Environment Variables":
-----------------------------
_ /usr/bin/daemon
BUILD_CAUSE MANUALTRIGGER
BUILD_CAUSE_MANUALTRIGGER true
BUILD_DISPLAY_NAME #4
BUILD_ID 2014-08-15_10-40-44
BUILD_NUMBER 4
BUILD_TAG jenkins-magjac-999-dev-smoke-fw025-nosa3-4
BUILD_URL http://smoketest.netinsight.se/jenkins/job/magjac-999-dev-smoke-fw025-nosa3/4/
BUILD_USER magjac
BUILD_USER_FIRST_NAME magjac
BUILD_USER_ID magjac
CONFIG_FILE fw025.rc
DISPLAY worabu.netinsight.se:0.0
DO_COPY true
DO_INSTALL false
DO_PUBLISH false
DO_TEST true
EXECUTOR_NUMBER 324
EXIT_ON_FAILURE false
GIT_ROOT /home/magjac/git_repos2
HOME /home/smoker
HUDSON_HOME /srv/lhome/jenkins
HUDSON_SERVER_COOKIE dad1862e4df27e29
HUDSON_URL http://smoketest.netinsight.se/jenkins/
JENKINS_HOME /srv/lhome/jenkins
JENKINS_SERVER_COOKIE dad1862e4df27e29
JENKINS_URL http://smoketest.netinsight.se/jenkins/
JOB_NAME magjac-999-dev-smoke-fw025-nosa3
JOB_URL http://smoketest.netinsight.se/jenkins/job/magjac-999-dev-smoke-fw025-nosa3/
LANG C
LC_COLLATE sv_SE.UTF-8
LC_CTYPE sv_SE.UTF-8
LC_MEASUREMENT sv_SE.UTF-8
LC_NUMERIC sv_SE.UTF-8
LC_PAPER sv_SE.UTF-8
LC_TIME en_DK.UTF-8
LD_LIBRARY_PATH /usr/lib/jvm/java-6-openjdk-amd64/jre/lib/amd64/server:/usr/lib/jvm/java-6-openjdk-amd64/jre/lib/amd64:/usr/lib/jvm/java-6-openjdk-amd64/jre/../lib/amd64
LOGNAME smoker
MAIL /var/mail/smoker
NETI_BUILDID testing
NODE_LABELS master master_label null
NODE_PATH /usr/lib/nodejs:/usr/lib/node_modules:/usr/share/_javascript_
PATH /home/smoker/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
PWD /home/smoker
PYTHONUSERBASE /home/smoker/.local
SHELL /bin/bash
SHLVL 1
SUBSYSTEM nosa
TERM rxvt
TESTSUITE_RC testsuite.rc
TRACK dev/smoke
USER smoker
WORKSPACE /srv/lhome/jenkins/jobs/magjac-999-dev-smoke-fw025-nosa3/workspace
Configuration XML:
------------------
<?xml version="1.0" encoding="UTF-8"?><project>
<actions/>
<description/>
<displayName>magjac-999-dev/smoke-fw025-nosa3</displayName>
<logRotator class="hudson.tasks.LogRotator">
<daysToKeep>100</daysToKeep>
<numToKeep>-1</numToKeep>
<artifactDaysToKeep>-1</artifactDaysToKeep>
<artifactNumToKeep>-1</artifactNumToKeep>
</logRotator>
<keepDependencies>false</keepDependencies>
<properties>
<hudson.model.ParametersDefinitionProperty>
<parameterDefinitions>
<hudson.model.StringParameterDefinition>
<name>NETI_BUILDID</name>
<description>The build id of the build from dev/smoke to install. Normally of the form YYYY-MM-DD.N, but can also be the name of a symbolic link that will be resolved before the installation begins. Examples: 2013-01-29.0 or continuous.</description>
<defaultValue>testing</defaultValue>
</hudson.model.StringParameterDefinition>
<hudson.model.StringParameterDefinition>
<name>TRACK</name>
<description>Software track to test</description>
<defaultValue>dev/smoke</defaultValue>
</hudson.model.StringParameterDefinition>
<hudson.model.StringParameterDefinition>
<name>SUBSYSTEM</name>
<description>Subsystem to test</description>
<defaultValue>nosa</defaultValue>
</hudson.model.StringParameterDefinition>
<hudson.model.StringParameterDefinition>
<name>dcpver</name>
<description/>
<defaultValue/>
</hudson.model.StringParameterDefinition>
<hudson.model.StringParameterDefinition>
<name>CONFIG_FILE</name>
<description>pconf configuration file for testrunner.</description>
<defaultValue>fw025.rc</defaultValue>
</hudson.model.StringParameterDefinition>
<hudson.model.BooleanParameterDefinition>
<name>DO_INSTALL</name>
<description>Install a repository on the node before running the tests
</description>
<defaultValue>false</defaultValue>
</hudson.model.BooleanParameterDefinition>
<hudson.model.BooleanParameterDefinition>
<name>DO_TEST</name>
<description>Perform the actual test step.</description>
<defaultValue>true</defaultValue>
</hudson.model.BooleanParameterDefinition>
<hudson.model.BooleanParameterDefinition>
<name>DO_PUBLISH</name>
<description>Publish the result to the CI server</description>
<defaultValue>false</defaultValue>
</hudson.model.BooleanParameterDefinition>
<hudson.model.ChoiceParameterDefinition>
<name>GIT_ROOT</name>
<description>Root directory of the git clones. An Absolute path or a path relative to the Jenkins job workspace.
Clones of the relevant repositories must exist and have the same directory structure as on the git server http://git.netinsight.se
Normally the git clones are checked out to the job workspace by the Jenkins job itself.
</description>
<choices class="java.util.Arrays$ArrayList">
<a class="string-array">
<string>/home/magjac/git_repos2</string>
<string>/home/magjac/git_repos2</string>
</a>
</choices>
</hudson.model.ChoiceParameterDefinition>
<hudson.model.BooleanParameterDefinition>
<name>EXIT_ON_FAILURE</name>
<description>Stops further testing immediately when an error is detected.</description>
<defaultValue>false</defaultValue>
</hudson.model.BooleanParameterDefinition>
<hudson.model.StringParameterDefinition>
<name>RF_TEST</name>
<description>Overrride Robot Framework test cases to run by name or long name.</description>
<defaultValue/>
</hudson.model.StringParameterDefinition>
<hudson.model.StringParameterDefinition>
<name>EXCLUDE_SYSTEST</name>
<description>Exclude tests matching pattern from testsuite (using -x option to testrun.py).</description>
<defaultValue/>
</hudson.model.StringParameterDefinition>
<hudson.model.StringParameterDefinition>
<name>INCLUDE_SYSTEST</name>
<description>Include only tests matching pattern from testsuite (using -m option to testrun.py). Default is to include all tests.</description>
<defaultValue/>
</hudson.model.StringParameterDefinition>
<hudson.model.BooleanParameterDefinition>
<name>DO_COPY</name>
<description>Updated the copied autobuilder repository in the smoketest storage area with info about the tests.
</description>
<defaultValue>true</defaultValue>
</hudson.model.BooleanParameterDefinition>
<hudson.model.StringParameterDefinition>
<name>NODE_MODEL</name>
<description>Node model, e.g. nimbra380, nimbra688, nimbraVA220, ...</description>
<defaultValue/>
</hudson.model.StringParameterDefinition>
<hudson.model.StringParameterDefinition>
<name>TESTSUITE_RC</name>
<description/>
<defaultValue>testsuite.rc</defaultValue>
</hudson.model.StringParameterDefinition>
</parameterDefinitions>
</hudson.model.ParametersDefinitionProperty>
<EnvInjectJobProperty plugin="envinject@1.89">
<info>
<loadFilesFromMaster>false</loadFilesFromMaster>
</info>
<on>true</on>
<keepJenkinsSystemVariables>true</keepJenkinsSystemVariables>
<keepBuildVariables>true</keepBuildVariables>
<contributors/>
</EnvInjectJobProperty>
</properties>
<scm class="hudson.scm.NullSCM"/>
<assignedNode>master</assignedNode>
<canRoam>false</canRoam>
<disabled>false</disabled>
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
<triggers/>
<concurrentBuild>false</concurrentBuild>
<builders>
<hudson.tasks.Shell>
<command>rm -rf infrastructure
if [ $GIT_ROOT = "." ]; then
git clone ssh://gito...@git.netinsight.se/infrastructure/ci-tools.git infrastructure/ci-tools
fi
$GIT_ROOT/infrastructure/ci-tools/bin/jenkins-run-smoketest
</command>
</hudson.tasks.Shell>
</builders>
<publishers>
<hudson.tasks.junit.JUnitResultArchiver>
<testResults>test-result.xml, TEST-*.xml</testResults>
<keepLongStdio>false</keepLongStdio>
<testDataPublishers/>
</hudson.tasks.junit.JUnitResultArchiver>
<org.jvnet.hudson.plugins.groovypostbuild.GroovyPostbuildRecorder plugin="groovy-postbuild@1.8">
<groovyScript>import hudson.model.*
def result = manager.build.result
def pa = new ParametersAction([
new StringParameterValue("NETI_BUILD_RESULT", "${result}")
])
// add variable to current job
Thread.currentThread().executable.addAction(pa)
</groovyScript>
<behavior>0</behavior>
</org.jvnet.hudson.plugins.groovypostbuild.GroovyPostbuildRecorder>
<hudson.plugins.robot.RobotPublisher plugin="robot@1.4.2">
<outputPath>.</outputPath>
<reportFileName>report.html</reportFileName>
<logFileName>log.html</logFileName>
<outputFileName>output.xml</outputFileName>
<disableArchiveOutput>false</disableArchiveOutput>
<passThreshold>100.0</passThreshold>
<unstableThreshold>0.0</unstableThreshold>
<otherFiles>
<string>rf_tests//.txt</string>
</otherFiles>
<onlyCritical>true</onlyCritical>
</hudson.plugins.robot.RobotPublisher>
<org.jenkinsci.plugins.postbuildscript.PostBuildScript plugin="postbuildscript@0.16">
<buildSteps>
<hudson.tasks.Shell>
<command>if [ "$EXECUTOR_NUMBER" != "-1" ]; then
$GIT_ROOT/infrastructure/ci-tools/bin/jenkins-postbuild-smoketest
fi
</command>
</hudson.tasks.Shell>
</buildSteps>
<scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
<scriptOnlyIfFailure>false</scriptOnlyIfFailure>
</org.jenkinsci.plugins.postbuildscript.PostBuildScript>
<hudson.tasks.ArtifactArchiver>
<artifacts>logs/,rf_testlogs.tar,netsimlogs.tar,*nodeinfo.tar,pconf_rc/*.rc, publish.xml</artifacts>
<latestOnly>false</latestOnly>
<allowEmptyArchive>false</allowEmptyArchive>
</hudson.tasks.ArtifactArchiver>
<hudson.plugins.summary__report.ACIPluginPublisher plugin="summary_report@1.10">
<name>publish.xml</name>
</hudson.plugins.summary__report.ACIPluginPublisher>
<hudson.tasks.Mailer plugin="mailer@1.8">
<recipients>mag...@netinsight.net#</recipients>
<dontNotifyEveryUnstableBuild>false</dontNotifyEveryUnstableBuild>
<sendToIndividuals>false</sendToIndividuals>
</hudson.tasks.Mailer>
</publishers>
<buildWrappers>
<hudson.plugins.timestamper.TimestamperBuildWrapper plugin="timestamper@1.5.11"/>
<com.lookout.jenkins.EnvironmentScript plugin="environment-script@1.1.2">
<script>if [ -h /neti/smoketest/dev/smoke/$NETI_BUILDID ]; then
- resolve symbolic link to actual build id
NETI_BUILDID_RESOLVED=$(readlink /neti/smoketest/dev/smoke/$NETI_BUILDID)
else
NETI_BUILDID_RESOLVED=$NETI_BUILDID
fi
echo NETI_BUILDID_RESOLVED=$NETI_BUILDID_RESOLVED
echo TEST_NODE=fw025
echo PUBLISH_CMD=/usr/local/bin/publish-smoketest
echo NETI_BUILD_NAME=dev/smoke
echo NETI_PHASE_NAME="3"
echo TEST_NODES=fw025
</script>
<onlyRunOnParent>false</onlyRunOnParent>
</com.lookout.jenkins.EnvironmentScript>
<hudson.plugins.locksandlatches.LockWrapper plugin="locks-and-latches@0.6">
<locks>
<hudson.plugins.locksandlatches.LockWrapper_-LockWaitConfig>
<name>node_fw025</name>
</hudson.plugins.locksandlatches.LockWrapper_-LockWaitConfig>
</locks>
</hudson.plugins.locksandlatches.LockWrapper>
<org.jenkinsci.plugins.builduser.BuildUser plugin="build-user-vars-plugin@1.3"/>
</buildWrappers>
</project>
|