Please add an option to disable echo of the command being executed (echo to log).

      Most of the time the commands only make the log less clear to read and harder to inspect.

      Current workaround is to put commands in a script and just execute the script. This however is not a viable workaround in all cases.

          [JENKINS-33455] Option to disable echo of executed commands

          Maciej Jaros added a comment -

          BTW for standard "Execute shell" step there is a better workaround - you can simply add `set +x` command to disable echo. However this doesn't work for the SSH plugin.

          Maciej Jaros added a comment - BTW for standard "Execute shell" step there is a better workaround - you can simply add `set +x` command to disable echo. However this doesn't work for the SSH plugin.

          Rachel M. added a comment -

          I got it with:

          #!/bin/bash +x
          

          Rachel M. added a comment - I got it with: #!/bin/bash +x

          Alex Earl added a comment -

          It looks like there is already a workaround for this, I would recommend using that workaround.

          Alex Earl added a comment - It looks like there is already a workaround for this, I would recommend using that workaround.

          david ducker added a comment -

          I agree this makes logs so much harder to read with no added value.
          Unless I'm mistaken you would have to set +x for every single shell, some of my scripts have 100's. This is not an adequate workaround.

          david ducker added a comment - I agree this makes logs so much harder to read with no added value. Unless I'm mistaken you would have to set +x for every single shell, some of my scripts have 100's. This is not an adequate workaround.

          Maciej Jaros added a comment - - edited

          rachel are you sure you are using SSH plugin? That is are you using "Send files or execute commands over SSH"? I tried your workaround and it doesn't work for SSH step. It only works for "Execute shell" step which is not what the task is about.

          Maciej Jaros added a comment - - edited rachel are you sure you are using SSH plugin? That is are you using "Send files or execute commands over SSH"? I tried your workaround and it doesn't work for SSH step. It only works for "Execute shell" step which is not what the task is about.

          Rachel M. added a comment -

          Hi nux, which Operating System is Jenkins running on?

          Rachel M. added a comment - Hi nux , which Operating System is Jenkins running on?

          Rachel M. added a comment -

          Sorry nux, which Operating System are you sending the commands to?

          Rachel M. added a comment - Sorry nux , which Operating System are you sending the commands to?

          Maciej Jaros added a comment - - edited

          I'm using Debian 9, but I used much older linux before and it also didn't work...

          On which system and/or plugin version does it suppose to work?

          Maciej Jaros added a comment - - edited I'm using Debian 9, but I used much older linux before and it also didn't work... On which system and/or plugin version does it suppose to work?

          Rachel M. added a comment -

          I was wondering if /bin/bash made sense on the machine you are sending the commands.

          It was a long time ago, but I remember that I finally managed not to need to disable echo of executed commands, when removing all the sensitive data in the commands.

          I've seen you reported this issue because of a log less clear to read and harder to inspect. In that case, please, check that /bin/bash makes sense on the machine you are sending the commands.

          I think that only:

          set +x

          works on the machine where Jenkins is running (Execute shell step), because the use of Unix Shell is implicit. When sending commands (Publish over SSH step), I had to make explicit the use of Unix Shell.

          In other words:

          #!/bin/bash +x

          is the same as:

          #!/bin/bash
          
          set +x
          

          I hope this information is useful for you in order to find out the solution. Otherwise, so sorry if my comment/workaround made this issue to be resolved. Just Reopen Issue in order to get a solution for you.

          Rachel M. added a comment - I was wondering if /bin/bash made sense on the machine you are sending the commands. It was a long time ago, but I remember that I finally managed not to need to disable echo of executed commands, when removing all the sensitive data in the commands. I've seen you reported this issue because of a log less clear to read and harder to inspect . In that case, please, check that /bin/bash makes sense on the machine you are sending the commands . I think that only: set +x works on the machine where Jenkins is running ( Execute shell step), because the use of Unix Shell is implicit. When sending commands ( Publish over SSH step), I had to make explicit the use of Unix Shell. In other words: #!/bin/bash +x is the same as: #!/bin/bash set +x I hope this information is useful for you in order to find out the solution. Otherwise, so sorry if my comment/workaround made this issue to be resolved. Just Reopen Issue in order to get a solution for you.

          Maciej Jaros added a comment -

          Problem is that Jenkins displays the information. Not really echo from console.

          Actual workaround is not to use Publish over SSH step and use ssh command... But then you have to mess with MoTD and some tty warnings.
          https://serverfault.com/questions/36421/stop-ssh-login-from-printing-motd-from-the-client/764403#764403

          That also kind of defeats the purpose of setting up ssh connections in Jenkins. So would be better to simply fix SSH in Jenkins.

          Maciej Jaros added a comment - Problem is that Jenkins displays the information. Not really echo from console. Actual workaround is not to use Publish over SSH step and use ssh command... But then you have to mess with MoTD and some tty warnings. https://serverfault.com/questions/36421/stop-ssh-login-from-printing-motd-from-the-client/764403#764403 That also kind of defeats the purpose of setting up ssh connections in Jenkins. So would be better to simply fix SSH in Jenkins.

          Alex Earl added a comment -

          To be clear, do you just not want the commands echo'd, or the full stdout/stderr from the execution of the commands?

          Alex Earl added a comment - To be clear, do you just not want the commands echo'd, or the full stdout/stderr from the execution of the commands?

          Maciej Jaros added a comment - - edited

          I don't want the commands from Publish over SSH step to be shown in Jenkins job log.

          Commands which should not be shown because they can contain passwords or because they are simply long and confusing.

          Maciej Jaros added a comment - - edited I don't want the commands from Publish over SSH step to be shown in Jenkins job log. Commands which should not be shown because they can contain passwords or because they are simply long and confusing.

          Alex Earl added a comment -

          What I decided to do was wrap the command output in a check for verbose output. I am not sure this is the best way to go, so I am soliciting feedback.

          https://github.com/jenkinsci/publish-over-ssh-plugin/commit/6df164a8aa191650497c4416d2364c72682e364d

          Alex Earl added a comment - What I decided to do was wrap the command output in a check for verbose output. I am not sure this is the best way to go, so I am soliciting feedback. https://github.com/jenkinsci/publish-over-ssh-plugin/commit/6df164a8aa191650497c4416d2364c72682e364d

          For your information, all publish-over-ssh component type JENKINS issues related to the Publish Over SSH plugin have been transferred to Github: https://github.com/jenkinsci/publish-over-ssh-plugin/issues

          Here is the direct link to this issue in Github: https://github.com/jenkinsci/publish-over-ssh-plugin/issues/143
          And here is the link to a search for related issues: https://github.com/jenkinsci/publish-over-ssh-plugin/issues?q=%22JENKINS-33455%22

          (Note: this is an automated bulk comment)

          Gavin McDonald added a comment - For your information, all publish-over-ssh component type JENKINS issues related to the Publish Over SSH plugin have been transferred to Github: https://github.com/jenkinsci/publish-over-ssh-plugin/issues Here is the direct link to this issue in Github: https://github.com/jenkinsci/publish-over-ssh-plugin/issues/143 And here is the link to a search for related issues: https://github.com/jenkinsci/publish-over-ssh-plugin/issues?q=%22JENKINS-33455%22 (Note: this is an automated bulk comment)

          Closing ticket, please use the corresponding Github Issue as linked above.

          Gavin McDonald added a comment - Closing ticket, please use the corresponding Github Issue as linked above.

            Unassigned Unassigned
            nux Maciej Jaros
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: