Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-11595

Some env variables can not be used to inject, for example $NODE_NAME

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • envinject-plugin
    • None
    • master or slave node without special settings

      This simple injection fails:
      cfgLocation="--env-cfg=${HOME}/${NODE_NAME}"

      It seems that envinject only uses a subset of the environment variables available at the time of evaluating. In contrast, testing the same using a Shell execution works as expected:

      env
      cfgLocation="--env-cfg=${HOME}/${NODE_NAME}"
      echo "manually set[${cfgLocation}]"

      The full output of both (uninteresting things omitted) is shown here:

      Started by user ....
      Building on master
      [EnvInject] - Injecting as environment variables the properties content
      'cfgLocation="--env-cfg=/var/lib/jenkins/${NODE_NAME}"
      '

      [EnvInject] - Unset unresolved 'cfgLocation' variable.
      [envinject test] $ /bin/sh -xe /tmp/hudson9116632610853382727.sh
      + env
      JENKINS_HOME=/var/lib/jenkins
      USER=jenkins
      MAIL=/var/mail/jenkins
      LD_LIBRARY_PATH=/usr/lib/jvm/java-6-openjdk/jre/lib/i386/client:/usr/lib/jvm/java-6-openjdk/jre/lib/i386:/usr/lib/jvm/java-6-openjdk/jre/../lib/i386
      HUDSON_URL=http://example.org/
      NODE_LABELS=master
      SHLVL=1
      HOME=/var/lib/jenkins
      WORKSPACE=/var/lib/jenkins/workspace/envinject test
      NODE_NAME=master
      LOGNAME=jenkins
      _=/usr/bin/daemon
      EXECUTOR_NUMBER=0
      TERM=xterm
      HUDSON_HOME=/var/lib/jenkins
      PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
      BUILD_ID=2011-11-03_12-37-03
      BUILD_TAG=jenkins-envinject test-4
      LANG=en_US.UTF-8
      BUILD_NUMBER=4
      SHELL=/bin/bash
      JOB_NAME=envinject test
      PWD=/var/lib/jenkins/workspace/envinject test
      + cfgLocation=--env-cfg=/var/lib/jenkins/master
      + echo manually set[--env-cfg=/var/lib/jenkins/master]
      manually set[--env-cfg=/var/lib/jenkins/master]
      Finished: SUCCESS

            gbois Gregory Boissinot
            marcelhuber Marcel Huber
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: