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

Environment variables not seen from within Tcl script

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • tcl-plugin
    • None
    • Jenkins 1.597, Windows 7 x64, Oracle Java 1.7, Tcl Plugin 0.4, tclsh 8.4

      I can not access my system environment variables from the Tcl plugin. For example, I create the following plugin code to display my environment:

      puts "Environment (as seen from Tcl)"
      foreach {var val} [array get ::env] {
        puts "$var=$val"
      }
      

      Running the Job, the output looks like this:

      Environment (as seen from Tcl)
      java.vm.version=23.25-b01
      javax.net.ssl.trustStorePassword=changeit
      java.vendor.url=http://java.oracle.com/
      sun.jnu.encoding=Cp1252
      hudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle
      java.vm.info=mixed mode
      java.awt.headless=true
      user.dir=C:\Jenkins
      sun.cpu.isalist=pentium_pro+mmx pentium_pro pentium+mmx pentium i486 i386 i86
      java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment
      sun.os.patch.level=Service Pack 1
      javax.net.ssl.trustStore=C:\Jenkins\keystore
      java.io.tmpdir=C:\Windows\TEMP\
      ....
      

      I don't see my Windows environment variables (say, PATH or USERNAME) with the exception of CLASSPATH, TCL_CLASSPATH, USER and HOME, nor do I see any of the environment variables I have defined in the environment definition of my Jenkins job. Instead, I find on ::env a lot of settings which look to me like the contents of a Java property file.

      Funnily, some settings from the environment are present, though under a different name. For example, the content of the environment name USERNAME is now found under ::env(user.name).

            Unassigned Unassigned
            rovf Ronald Fischer
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: