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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Component/s: ssh-plugin
    • Labels:
    • Environment:
    • Similar Issues:

      Description

      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

        Attachments

          Activity

          Hide
          thejoshw 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.

          Show
          thejoshw 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.
          Hide
          thejoshw 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.

          Show
          thejoshw 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.

            People

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

              Dates

              Created:
              Updated: