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

Enviroment variables are not loaded in ssh using cygwin

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Major Major
    • ssh-slaves-plugin
    • None

      When configuring an ssh slave which runs on cygwin, the environment variables are not loaded.
      However I do know that ~/.bash_profile is executed and sourced, because it will display echo commands in the output console if I insert them there.
      Also things like PATH and PWD do not exist, causing any command to fail.

      Output from the ssh looks like this (note remote environment is empty):

      [03/11/13 18:40:35] [SSH] Opening SSH connection to vmbld-vc902:22.
      
      [03/11/13 18:40:36] [SSH] Authentication successful.
      [03/11/13 18:40:36] [SSH] The remote users environment is:
      [03/11/13 18:40:37] [SSH] Checking java version of java
      
      Couldn't figure out the Java version of java
      
      [03/11/13 18:40:37] [SSH] Checking java version of /usr/bin/java
      Couldn't figure out the Java version of /usr/bin/java
      
      [03/11/13 18:40:38] [SSH] Checking java version of /usr/java/default/bin/java
      
      Couldn't figure out the Java version of /usr/java/default/bin/java
      
      [03/11/13 18:40:38] [SSH] Checking java version of /usr/java/latest/bin/java
      Couldn't figure out the Java version of /usr/java/latest/bin/java
      
      [03/11/13 18:40:38] [SSH] Checking java version of /usr/local/bin/java
      Couldn't figure out the Java version of /usr/local/bin/java
      
      [03/11/13 18:40:39] [SSH] Checking java version of /usr/local/java/bin/java
      
      Couldn't figure out the Java version of /usr/local/java/bin/java
      
      [03/11/13 18:40:39] [SSH] Checking java version of /home/packaging/test/jdk/bin/java
      Couldn't figure out the Java version of /home/packaging/test/jdk/bin/java

      If I forcefully point the JAVA_PATH to java (located at /usr/bin/java) I get:

      [03/11/13 18:59:55] [SSH] Opening SSH connection to vmbld-vc902:22.
      
      [03/11/13 18:59:55] [SSH] Authentication successful.
      [03/11/13 18:59:56] [SSH] The remote users environment is:
      
      [03/11/13 18:59:57] [SSH] Starting sftp client.
      [03/11/13 18:59:57] [SSH] SFTP failed. Copying via SCP.
      
      [03/11/13 18:59:58] [SSH] Remote file system root /home/packaging/test does not exist. Will try to create it...
      Failed to create /home/packaging/test
      
      [03/11/13 18:59:58] [SSH] Copying latest slave.jar...
      hudson.util.IOException2: Could not copy slave.jar into '/home/packaging/test' on slave
      	at hudson.plugins.sshslaves.SSHLauncher.copySlaveJarUsingSCP(SSHLauncher.java:800)
      	at hudson.plugins.sshslaves.SSHLauncher.copySlaveJar(SSHLauncher.java:759)
      	at hudson.plugins.sshslaves.SSHLauncher.launch(SSHLauncher.java:468)
      	at hudson.slaves.SlaveComputer$1.call(SlaveComputer.java:222)
      	at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
      	at java.util.concurrent.FutureTask.run(Unknown Source)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      	at java.lang.Thread.run(Unknown Source)
      Caused by: java.io.IOException: Error during SCP transfer.
      	at com.trilead.ssh2.SCPClient.put(SCPClient.java:523)
      	at hudson.plugins.sshslaves.SSHLauncher.copySlaveJarUsingSCP(SSHLauncher.java:798)
      	... 8 more
      Caused by: java.io.IOException: Remote scp terminated unexpectedly.
      	at com.trilead.ssh2.SCPClient.readResponse(SCPClient.java:50)
      	at com.trilead.ssh2.SCPClient.sendBytes(SCPClient.java:140)
      	at com.trilead.ssh2.SCPClient.put(SCPClient.java:519)
      	... 9 more
      [03/11/13 18:59:59] [SSH] Connection closed.

      Cygwin verion 1.5.24-2
      SSH from the machine that runs Jenkins to the machine works fine.

      I know this is not a lot for recreation, If you need any other logs to troubleshoot them please specify in the comments

            ifernandezcalvo Ivan Fernandez Calvo
            guysoft Guy Sheffer
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: