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

sshCommand returns - org.hidetake.groovy.ssh.session.BadExitStatusException: Command returned exit status 8

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • ssh-steps-plugin
    • Jenkins Master - Linux
      Remote Host - Linux
      Remote Directory - /opt/bix/home/int/Phase1_Automation/
      Remote File - TEST_AUTOMATION_New.ksh

      While executing the job which takes 3 parameters from the "Build with parameter" option to execute the remotely placed script,it failed with below error :-
      org.hidetake.groovy.ssh.session.BadExitStatusException: Command returned exit status 8: ksh

      The script works fine when executed on remote host independently.
       

      Pipeline Script 

      pipeline {
      agent {
      kubernetes {
      // https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#syntax-and-character-set
      // take job name -1 (dash) - build number length
      label "${JOB_NAME.replaceAll("[^a-z0-9A-Z]+", "").replaceAll("^[^a-z0-9A-Z]*", "").take(63 - 1 - BUILD_NUMBER.length())}${BUILD_NUMBER}"
      inheritFrom "jenkins-slave"
      }
      }

      stages {
      stage("ssh") {
      steps {
      script {
      withCredentials([usernamePassword(credentialsId: "<CRED_ID>", usernameVariable: "USERNAME", passwordVariable: "PASSWORD")])

      { Map remote = [ name: <HOST_NAME>, host: <HOST>, password: "$PASSWORD", allowAnyHosts: true, user: "$USERNAME", pty: true ] sshCommand remote: remote, command: "ksh /opt/bix/home/int/Phase1_Automation/TEST_AUTOMATION_New.ksh $REL_NAME $TEST_ITERATION $CHECK_TYPE" }

      }
      }
      }
      }
      }

            nrayapati Naresh Rayapati
            akshay_tanksale Akshay Tanksale
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: