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

allow for variable interpolation in site name

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Major Major
    • ssh-plugin
    • None
    • Jenkins 1.518
      SSH Plugin 2.3

      We have a need to pass in a variable from a slave node to connect to a certain IP address to execute the script.

      For example, our master runs a job on slave1.
      Slave1 has an environment variable configured of: builder_ip=10.1.1.181

      As seen below the echo command is the ${builder_ip}. I need the ssh site name to interpolate that variable as well.

      Started by user anonymous
      [EnvInject] - Loading node environment variables.
      Building remotely on vmdkDriver1 in workspace /tmp/workspace/concurrency_test
      [concurrency_test] $ /bin/sh -xe /tmp/hudson4711012832981264076.sh

      + echo 10.1.1.181
      10.1.1.181

      executing script:

      hostname
      ifconfig eth0

      [SSH] Exception:java.net.UnknownHostException: ${builder_ip}
      com.jcraft.jsch.JSchException: java.net.UnknownHostException: ${builder_ip}
      at com.jcraft.jsch.Util.createSocket(Util.java:341)
      at com.jcraft.jsch.Session.connect(Session.java:182)
      at com.jcraft.jsch.Session.connect(Session.java:150)
      at org.jvnet.hudson.plugins.SSHSite.createSession(SSHSite.java:118)
      at org.jvnet.hudson.plugins.SSHSite.executeCommand(SSHSite.java:128)
      at org.jvnet.hudson.plugins.SSHBuilder.perform(SSHBuilder.java:60)
      at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
      at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:804)
      at hudson.model.Build$BuildExecution.build(Build.java:199)
      at hudson.model.Build$BuildExecution.doRun(Build.java:160)
      at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:586)
      at hudson.model.Run.execute(Run.java:1576)
      at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
      at hudson.model.ResourceController.execute(ResourceController.java:88)
      at hudson.model.Executor.run(Executor.java:241)
      Caused by: java.net.UnknownHostException: ${builder_ip}
      at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:175)
      at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:384)
      at java.net.Socket.connect(Socket.java:546)
      at java.net.Socket.connect(Socket.java:495)
      at java.net.Socket.<init>(Socket.java:392)
      at java.net.Socket.<init>(Socket.java:206)
      at com.jcraft.jsch.Util.createSocket(Util.java:335)
      ... 14 more
      Build step 'Execute shell script on remote host using ssh' marked build as failure
      Finished: FAILURE

            Unassigned Unassigned
            peter_kline Peter Kline
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: