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

Assumes default shell is bourne shell or bash and can not set jenkins environment varaibles if another shell

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: ssh-plugin
    • Labels:
    • Environment:
      linux, 64bit, SLED 11, tcsh shell.
    • Similar Issues:

      Description

      I have an issue. It seems that the SSH plugin presumes that the shell is bourne shell? However, in my case it is actually tcsh and this is causing some problems.

      I am interested in some of the jenkins environment variables such as NODE_NAME, and this plugin is smart enough to know that (because I am referencing to this environment variable in the build section of the plugin in order to navigate to a directory on the slave). So it will set the jenkins specific environment variable before the shell scripts and such in the build section are executed. Sounds good so far. However, it tries to do an export NODE_NAME = ${NODE_NAME} and of course it fails as this is not recognized in tcsh. It should have been setenv NODE_NAME ${NODE_NAME}

      . Could you update plugin and check what type of shell is default and then set up the environment variables accordingly.

      Example output:

      executing script:
      export NODE_NAME="lab54"

      cd /view/shma_jenkins_${NODE_NAME}/vobs/pxxx/pap_pop_aha_tst/aztec_common_scripts
      ./build
      export: Command not found.
      NODE_NAME: Undefined variable.
      ./build: Command not found.
      [SSH] exit-status: 1
      Build step 'Execute shell script on remote host using ssh' marked build as failure
      Terminating xvnc.
      $ vncserver -kill :11
      Killing Xvnc process ID 26889
      Finished: FAILURE

        Attachments

          Activity

          Hide
          edmund_wagner edmund_wagner added a comment -

          maybe exporting the variables is a bit overkill. i think NODE_NAME=${NODE_NAME} would be enough.
          whats your opinion on that solution?

          Show
          edmund_wagner edmund_wagner added a comment - maybe exporting the variables is a bit overkill. i think NODE_NAME=${NODE_NAME} would be enough. whats your opinion on that solution?
          Hide
          shamanmahmoudi Shaman Mahmoudi added a comment -

          Hi Edmund,

          I agree. Thanks.

          Show
          shamanmahmoudi Shaman Mahmoudi added a comment - Hi Edmund, I agree. Thanks.
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Edmund Wagner
          Path:
          src/main/java/org/jvnet/hudson/plugins/VariableReplacerUtil.java
          http://jenkins-ci.org/commit/ssh-plugin/d4dc43df6ec8eddadbaf5a20fecc93f4d3ef0542
          Log:
          fixed JENKINS-15265
          do not export variables, just set them

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Edmund Wagner Path: src/main/java/org/jvnet/hudson/plugins/VariableReplacerUtil.java http://jenkins-ci.org/commit/ssh-plugin/d4dc43df6ec8eddadbaf5a20fecc93f4d3ef0542 Log: fixed JENKINS-15265 do not export variables, just set them
          Hide
          edmund_wagner edmund_wagner added a comment -

          fixed in ssh plugin 2.3

          Show
          edmund_wagner edmund_wagner added a comment - fixed in ssh plugin 2.3
          Hide
          thejoshw Joshua Wherrett added a comment -

          This does not fix the problem when using a tcsh shell. VARIABLE=VALUE format does not work for tcsh. This issue should still be open.

          Show
          thejoshw Joshua Wherrett added a comment - This does not fix the problem when using a tcsh shell. VARIABLE=VALUE format does not work for tcsh. This issue should still be open.
          Hide
          thejoshw Joshua Wherrett added a comment -
          Show
          thejoshw Joshua Wherrett added a comment - Or see JENKINS-27095

            People

            • Assignee:
              edmund_wagner edmund_wagner
              Reporter:
              shamanmahmoudi Shaman Mahmoudi
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: