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

EnvInject claims global env vars are unresolved on slave

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: envinject-plugin
    • Labels:
      None
    • Environment:
      EnvInject 1.55
      Jenkins 1.472
    • Similar Issues:

      Description

      Steps to reproduce

      1. Go to Manage Jenkins > Configure System and check 'Environment variables' under 'Global properties'
      2. Add a variable called GLOBAL_VAR with the value $HOME/foo and save
      3. Create a new job, check 'Prepare an environment for the run' and put DERIVED_VAR=$GLOBAL_VAR/bar in 'Properties Content'.
      4. Check 'Restrict where this project can be run' and make it run on a node OTHER THAN master
      5. Add an 'Execute shell' build step and add:

      echo $GLOBAL_VAR
      echo $DERIVED_VAR

      6. Run job

      Expected output

      Building remotely on not_master in workspace /tmp/slave/workspace/env_test
      [env_test] $ /bin/sh -xe /var/folders/t5/2y9vs7rj20b7h_h3hj_d_ly98mbs7g/T/hudson2936884432042635298.sh
      /home/jenkins/foo
      /home/jenkins/foo/bar

      Actual output

      [EnvInject] - Unset unresolved 'GLOBAL_VAR' variable.
      [EnvInject] - Unset unresolved 'DERIVED_VAR' variable.
      Building remotely on not_master in workspace /tmp/slave/workspace/env_test
      [env_test] $ /bin/sh -xe /var/folders/t5/2y9vs7rj20b7h_h3hj_d_ly98mbs7g/T/hudson2936884432042635298.sh
      /home/jenkins/foo
      
      

        Attachments

          Activity

          jorgenpt Jørgen Tjernø created issue -
          jorgenpt Jørgen Tjernø made changes -
          Field Original Value New Value
          Description Steps to reproduce:

          1. Go to /configure and check 'Environment variables' under 'Global properties'
          2. Add a variable called GLOBAL_VAR with the value $HOME/foo and save
          3. Create a new job, check 'Prepare an environment for the run' and put 'DERIVED_VAR=$GLOBAL_VAR/bar' in 'Properties Content'.
          4. Check 'Restrict where this project can be run' and make it run on a node OTHER THAN master
          5. Add an 'Execute shell' build step and add: {code}echo $GLOBAL_VAR
          echo $DERIVED_VAR{code}
          6. Run job

          Expected output:
          {noformat}Building remotely on not_master in workspace /tmp/slave/workspace/env_test
          [env_test] $ /bin/sh -xe /var/folders/t5/2y9vs7rj20b7h_h3hj_d_ly98mbs7g/T/hudson2936884432042635298.sh
          /home/jenkins/foo
          /home/jenkins/foo/bar{noformat}

          Actual output:
          {noformat}
          [EnvInject] - Unset unresolved 'GLOBAL_VAR' variable.
          [EnvInject] - Unset unresolved 'DERIVED_VAR' variable.
          Building remotely on not_master in workspace /tmp/slave/workspace/env_test
          [env_test] $ /bin/sh -xe /var/folders/t5/2y9vs7rj20b7h_h3hj_d_ly98mbs7g/T/hudson2936884432042635298.sh
          /home/jenkins/foo

          {noformat}
          Steps to reproduce:

          1. Go to Manage Jenkins > Configure System and check 'Environment variables' under 'Global properties'
          2. Add a variable called GLOBAL_VAR with the value $HOME/foo and save
          3. Create a new job, check 'Prepare an environment for the run' and put 'DERIVED_VAR=$GLOBAL_VAR/bar' in 'Properties Content'.
          4. Check 'Restrict where this project can be run' and make it run on a node OTHER THAN master
          5. Add an 'Execute shell' build step and add: {code}echo $GLOBAL_VAR
          echo $DERIVED_VAR{code}
          6. Run job

          Expected output:
          {noformat}Building remotely on not_master in workspace /tmp/slave/workspace/env_test
          [env_test] $ /bin/sh -xe /var/folders/t5/2y9vs7rj20b7h_h3hj_d_ly98mbs7g/T/hudson2936884432042635298.sh
          /home/jenkins/foo
          /home/jenkins/foo/bar{noformat}

          Actual output:
          {noformat}
          [EnvInject] - Unset unresolved 'GLOBAL_VAR' variable.
          [EnvInject] - Unset unresolved 'DERIVED_VAR' variable.
          Building remotely on not_master in workspace /tmp/slave/workspace/env_test
          [env_test] $ /bin/sh -xe /var/folders/t5/2y9vs7rj20b7h_h3hj_d_ly98mbs7g/T/hudson2936884432042635298.sh
          /home/jenkins/foo

          {noformat}
          jorgenpt Jørgen Tjernø made changes -
          Description Steps to reproduce:

          1. Go to Manage Jenkins > Configure System and check 'Environment variables' under 'Global properties'
          2. Add a variable called GLOBAL_VAR with the value $HOME/foo and save
          3. Create a new job, check 'Prepare an environment for the run' and put 'DERIVED_VAR=$GLOBAL_VAR/bar' in 'Properties Content'.
          4. Check 'Restrict where this project can be run' and make it run on a node OTHER THAN master
          5. Add an 'Execute shell' build step and add: {code}echo $GLOBAL_VAR
          echo $DERIVED_VAR{code}
          6. Run job

          Expected output:
          {noformat}Building remotely on not_master in workspace /tmp/slave/workspace/env_test
          [env_test] $ /bin/sh -xe /var/folders/t5/2y9vs7rj20b7h_h3hj_d_ly98mbs7g/T/hudson2936884432042635298.sh
          /home/jenkins/foo
          /home/jenkins/foo/bar{noformat}

          Actual output:
          {noformat}
          [EnvInject] - Unset unresolved 'GLOBAL_VAR' variable.
          [EnvInject] - Unset unresolved 'DERIVED_VAR' variable.
          Building remotely on not_master in workspace /tmp/slave/workspace/env_test
          [env_test] $ /bin/sh -xe /var/folders/t5/2y9vs7rj20b7h_h3hj_d_ly98mbs7g/T/hudson2936884432042635298.sh
          /home/jenkins/foo

          {noformat}
          h3. Steps to reproduce
          1. Go to Manage Jenkins > Configure System and check 'Environment variables' under 'Global properties'
          2. Add a variable called GLOBAL_VAR with the value $HOME/foo and save
          3. Create a new job, check 'Prepare an environment for the run' and put 'DERIVED_VAR=$GLOBAL_VAR/bar' in 'Properties Content'.
          4. Check 'Restrict where this project can be run' and make it run on a node OTHER THAN master
          5. Add an 'Execute shell' build step and add: {code}echo $GLOBAL_VAR
          echo $DERIVED_VAR{code}
          6. Run job

          h3. Expected output
          {noformat}Building remotely on not_master in workspace /tmp/slave/workspace/env_test
          [env_test] $ /bin/sh -xe /var/folders/t5/2y9vs7rj20b7h_h3hj_d_ly98mbs7g/T/hudson2936884432042635298.sh
          /home/jenkins/foo
          /home/jenkins/foo/bar{noformat}

          h3. Actual output
          {noformat}
          [EnvInject] - Unset unresolved 'GLOBAL_VAR' variable.
          [EnvInject] - Unset unresolved 'DERIVED_VAR' variable.
          Building remotely on not_master in workspace /tmp/slave/workspace/env_test
          [env_test] $ /bin/sh -xe /var/folders/t5/2y9vs7rj20b7h_h3hj_d_ly98mbs7g/T/hudson2936884432042635298.sh
          /home/jenkins/foo

          {noformat}
          jorgenpt Jørgen Tjernø made changes -
          Description h3. Steps to reproduce
          1. Go to Manage Jenkins > Configure System and check 'Environment variables' under 'Global properties'
          2. Add a variable called GLOBAL_VAR with the value $HOME/foo and save
          3. Create a new job, check 'Prepare an environment for the run' and put 'DERIVED_VAR=$GLOBAL_VAR/bar' in 'Properties Content'.
          4. Check 'Restrict where this project can be run' and make it run on a node OTHER THAN master
          5. Add an 'Execute shell' build step and add: {code}echo $GLOBAL_VAR
          echo $DERIVED_VAR{code}
          6. Run job

          h3. Expected output
          {noformat}Building remotely on not_master in workspace /tmp/slave/workspace/env_test
          [env_test] $ /bin/sh -xe /var/folders/t5/2y9vs7rj20b7h_h3hj_d_ly98mbs7g/T/hudson2936884432042635298.sh
          /home/jenkins/foo
          /home/jenkins/foo/bar{noformat}

          h3. Actual output
          {noformat}
          [EnvInject] - Unset unresolved 'GLOBAL_VAR' variable.
          [EnvInject] - Unset unresolved 'DERIVED_VAR' variable.
          Building remotely on not_master in workspace /tmp/slave/workspace/env_test
          [env_test] $ /bin/sh -xe /var/folders/t5/2y9vs7rj20b7h_h3hj_d_ly98mbs7g/T/hudson2936884432042635298.sh
          /home/jenkins/foo

          {noformat}
          h3. Steps to reproduce
          1. Go to Manage Jenkins > Configure System and check 'Environment variables' under 'Global properties'
          2. Add a variable called {{GLOBAL_VAR}} with the value {{$HOME/foo}} and save
          3. Create a new job, check 'Prepare an environment for the run' and put {{DERIVED_VAR=$GLOBAL_VAR/bar}} in 'Properties Content'.
          4. Check 'Restrict where this project can be run' and make it run on a node *OTHER THAN* master
          5. Add an 'Execute shell' build step and add: {code}echo $GLOBAL_VAR
          echo $DERIVED_VAR{code}
          6. Run job

          h3. Expected output
          {noformat}Building remotely on not_master in workspace /tmp/slave/workspace/env_test
          [env_test] $ /bin/sh -xe /var/folders/t5/2y9vs7rj20b7h_h3hj_d_ly98mbs7g/T/hudson2936884432042635298.sh
          /home/jenkins/foo
          /home/jenkins/foo/bar{noformat}

          h3. Actual output
          {noformat}
          [EnvInject] - Unset unresolved 'GLOBAL_VAR' variable.
          [EnvInject] - Unset unresolved 'DERIVED_VAR' variable.
          Building remotely on not_master in workspace /tmp/slave/workspace/env_test
          [env_test] $ /bin/sh -xe /var/folders/t5/2y9vs7rj20b7h_h3hj_d_ly98mbs7g/T/hudson2936884432042635298.sh
          /home/jenkins/foo

          {noformat}
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Gregory Boissinot
          Path:
          src/main/java/org/jenkinsci/plugins/envinject/service/EnvInjectEnvVars.java
          http://jenkins-ci.org/commit/envinject-plugin/62ee63e51638c513f91439a0f0091a3435850eb0
          Log:
          Fix JENKINS-14271

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Gregory Boissinot Path: src/main/java/org/jenkinsci/plugins/envinject/service/EnvInjectEnvVars.java http://jenkins-ci.org/commit/envinject-plugin/62ee63e51638c513f91439a0f0091a3435850eb0 Log: Fix JENKINS-14271
          gbois Gregory Boissinot made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          rtyler R. Tyler Croy made changes -
          Workflow JNJira [ 144903 ] JNJira + In-Review [ 191241 ]

            People

            • Assignee:
              gbois Gregory Boissinot
              Reporter:
              jorgenpt Jørgen Tjernø
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: