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

Unable to pass arguments to remote ssh (other than bash)

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • ssh-plugin

      There is a variable in the build configuration named "topo_name".
      This 'topo_name' variable to be argument of the shell script to be run on the remote server. (Here it is simplified to echo $topo_name).

      Since the remote shell is C shell, it fails to get the argument.
      https://issues.jenkins-ci.org/browse/JENKINS-15265 - fix does NOT solve this.

      Is there any other solution/workaround?

      Logs:
      =====
      Started by user anonymous
      Building in workspace /var/lib/jenkins/jobs/test_ssh/workspace
      executing script:
      SHELL="/bin/bash"
      topo_name="testing" (Fix of JENKINS-15265)

      whoami
      env
      hostname
      echo $SHELL
      echo ${topo_name}
      SHELL=/bin/bash: Command not found. !!! C shell does NOT take the command !!!
      topo_name=testing: Command not found. !!! C shell does NOT take the command !!!
      topo_name: Undefined variable. !!! C shell does NOT take the command !!!
      nkaliape
      USER=nkaliape
      LOGNAME=nkaliape

          [JENKINS-27095] Unable to pass arguments to remote ssh (other than bash)

          A possible solution is to put #!/bin/bash at the start of the script before the VARIABLE=VALUE lines. This would mandate the rest of the script be bash compatible though. Or maybe better solution is to find/replace all the known variables with values before writing the script contents to the tmp file and executing.

          Joshua Wherrett added a comment - A possible solution is to put #!/bin/bash at the start of the script before the VARIABLE=VALUE lines. This would mandate the rest of the script be bash compatible though. Or maybe better solution is to find/replace all the known variables with values before writing the script contents to the tmp file and executing.

          In the mean time a possible workaround is to source a file that setenv's the variables used in the script at the start of the script. This sourced file will need to be configured in a previous local "Execute Shell" run and stored on a share that is accessible to the remote ssh host you are running on. A bit convoluted, however should get you out of trouble if you are stuck.

          Joshua Wherrett added a comment - In the mean time a possible workaround is to source a file that setenv's the variables used in the script at the start of the script. This sourced file will need to be configured in a previous local "Execute Shell" run and stored on a share that is accessible to the remote ssh host you are running on. A bit convoluted, however should get you out of trouble if you are stuck.

            Unassigned Unassigned
            nkaliape Narayanan Thottam Kaliaperumal
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: