在Jenkins文件中使用SSH管道sshCommand时无法cd

在Jenkins文件中使用SSH管道sshCommand时无法cd,jenkins,ssh,jenkins-pipeline,devops,pipeline,Jenkins,Ssh,Jenkins Pipeline,Devops,Pipeline,在我的jenkins脚本管道中,我正在运行的一个阶段是远程机器中的bash脚本。我尝试了以下几种方法,但没有满足以下要求: 因为我想远程登录到服务器,然后运行几个命令在同一个服务器上部署。我无法使用SSH管道cd 所以我想使用sshCommand在远程服务器上运行cd命令并执行脚本。发生的情况是,除了cd命令之外,所有其他shell命令都在执行 stage("CONFIGURE ENV") { withCredentials([usernamePassword(crede

在我的jenkins脚本管道中,我正在运行的一个阶段是远程机器中的bash脚本。我尝试了以下几种方法,但没有满足以下要求:

  • 因为我想远程登录到服务器,然后运行几个命令在同一个服务器上部署。我无法使用SSH管道
    cd
所以我想使用sshCommand在远程服务器上运行
cd
命令并执行脚本。发生的情况是,除了cd命令之外,所有其他shell命令都在执行

  stage("CONFIGURE ENV") {
        withCredentials([usernamePassword(credentialsId: 'xxxxxxxxxx', passwordVariable: 'Password', usernameVariable: 'Username')]) {
        remote.user = Username
        remote.password = Password
        sshCommand remote: remote, command: "cd /abc/set/"
        sshCommand remote: remote, command: "pwd"
        sshScript remote: remote, script: "env.sh"
运行生成时,我不断收到错误消息:


请将错误消息作为文本包含在内。不要使用文本图片。请尝试在方法参数中提供指向
env.sh
的路径。