When I have a script with multiple lines, I do not get any output from the 
script in the console output of the pipeline job.

https://www.jenkins.io/doc/pipeline/steps/ssh-steps/#sshscript-ssh-steps-sshscript-execute-scriptfile-on-remote-node

pipeline {
  agent {
    label 'docker-agent'
  }
  environment {
    SERVER_CREDS = credentials('server-user')
  }
  stages {
    stage('Deploy') {
      steps {
        echo "Deploy to server"
        script {
          def remote = [:]
          remote.name = 'server'
          remote.host = 'server.company.com'
          remote.user = env.SERVER_CREDS_USR
          remote.password = env.SERVER_CREDS_PSW
          remote.allowAnyHosts = true
          sshScript(
            remote: remote,
            script: 'deploy.sh'
          )
        }
      }
    }
  }
}


If I have more than one line in the script deploy.sh, I do not get any 
output

It seems if I have multiple lines that produce output, then I do not get 
any output.
If I have multiple lines, and only the last command there has an output, 
then I get the output in the pipeline console output.

This works:
#!/bin/bash
DIR=/tmp
ls -ltr $DIR

This does not work:
#!/bin/bash
DIR=/tmp
ls -ltr $DIR
ls -ltr

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/feb7fc34-41a4-4190-a94e-7f6e2872a814n%40googlegroups.com.

Reply via email to