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

Incorrect inserting environment variables on linux slave

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • envinject-plugin
    • None
    • master-windows, slave-linux

      I have problem with new plugin 1.5/1.6 (1.2 works well) on slave (linux) node. I've tried this plugin using "Inject environment variables to the build process" in "build environments". I used cmakebuilder plugin (not significant). Although a building process fail with cmake errors It is probably error in EnvInject plugin 1.5 version because the building process in 1.2 is ok. Bookmarks "Injected Environment Variable" in 1.2 contains environment variables from linux (slave), but 1.5/1.6 contains environment variable from windows (master). Thanks!

          [JENKINS-12293] Incorrect inserting environment variables on linux slave

          I have what apears to be the same problem. The slave looks like it has inherited $PATH from the master - not great when the master is a 32 bit machine whose $PATH points to 32 bit versions of various software, and the slave is a 64 bit machine.

          Matthew Webber added a comment - I have what apears to be the same problem. The slave looks like it has inherited $PATH from the master - not great when the master is a 32 bit machine whose $PATH points to 32 bit versions of various software, and the slave is a 64 bit machine.

          I can confirm that I needed to downgrade the plugin to 1.2 in order to resolve this problem.

          Matthew Webber added a comment - I can confirm that I needed to downgrade the plugin to 1.2 in order to resolve this problem.

          Could you attach your job configuration file (config.xml)?
          Thanks

          Gregory Boissinot added a comment - Could you attach your job configuration file (config.xml)? Thanks

          I have attached the config file for a job that works under 1.2. This job runs on a slave. In 1.2, the job did not inherit $PATH from the master, but in 1.5 it did.

          Matthew Webber added a comment - I have attached the config file for a job that works under 1.2. This job runs on a slave. In 1.2, the job did not inherit $PATH from the master, but in 1.5 it did.

          Peter Sukhenko added a comment - - edited

          Looks like problem introduced in 1.4 in EnvInjectComputerListener.java, line 74.
          Following code:

          Map<String, String> nodeEnvVars = Hudson.getInstance().getRootPath().act(
          new Callable<Map<String, String>, IOException>() {
          public Map<String, String> call() throws IOException

          { return EnvVars.masterEnvVars; }

          }
          );

          always get variables from master while should take from slave.
          Replacing it with

          Map<String, String> nodeEnvVars = c.getNode().getRootPath().act( ...

          resolved the issue

          Peter Sukhenko added a comment - - edited Looks like problem introduced in 1.4 in EnvInjectComputerListener.java, line 74. Following code: Map<String, String> nodeEnvVars = Hudson.getInstance().getRootPath().act( new Callable<Map<String, String>, IOException>() { public Map<String, String> call() throws IOException { return EnvVars.masterEnvVars; } } ); always get variables from master while should take from slave. Replacing it with Map<String, String> nodeEnvVars = c.getNode().getRootPath().act( ... resolved the issue

          Code changed in jenkins
          User: Gregory Boissinot
          Path:
          src/main/java/org/jenkinsci/plugins/envinject/EnvInjectComputerListener.java
          http://jenkins-ci.org/commit/envinject-plugin/948cf472a104f89f8ecccabcf71c40f585a01eed
          Log:
          Fix JENKINS-12293

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Gregory Boissinot Path: src/main/java/org/jenkinsci/plugins/envinject/EnvInjectComputerListener.java http://jenkins-ci.org/commit/envinject-plugin/948cf472a104f89f8ecccabcf71c40f585a01eed Log: Fix JENKINS-12293

          Thank you very much for all your inputs.
          Could you try the version 1.7. The problem should be fixed.

          Gregory Boissinot added a comment - Thank you very much for all your inputs. Could you try the version 1.7. The problem should be fixed.

          1.7 works fine for me.
          Thanks

          Peter Sukhenko added a comment - 1.7 works fine for me. Thanks

          Also working ok for me (Linux master 32-bit, Linux slave 64-bit). Thanks.

          Matthew Webber added a comment - Also working ok for me (Linux master 32-bit, Linux slave 64-bit). Thanks.

          juraj fedorko added a comment -

          Yes, it works correctly. Thanks.

          juraj fedorko added a comment - Yes, it works correctly. Thanks.

            gbois Gregory Boissinot
            ferda juraj fedorko
            Votes:
            2 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: