无法通过Jenkins中的SSH连接远程服务器

问题描述 投票:0回答:1

场景:在连接服务器时动态询问安装点详细信息,因此出现以下错误

脚本

node('agent') {

stage('Sync Repo') {  
  sshagent(['poc_ssh_key']) {
sh """
ssh -p XXX user@IP $mountpoint(Data003)

""" 
  }
}

错误

error:
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This system has been onboarded to TPAM.   Please use the TPAM interface link below to request privileged access to the server.
!!  TPAM URL:   
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Please enter the root path variable [data001/data002/data003/data004/data005]
You entered: 
jenkins jenkins-pipeline jenkins-plugins jenkins-groovy
1个回答
0
投票

经过大量研究,找到下面的解决方案,它正在按预期的方式工作。

node('agent'){

stage('Sync Repo'){sshagent(['poc_ssh_key']){sh“”“回声“ data003” | ssh -p 2022 user @ IP

“”“}}

© www.soinside.com 2019 - 2024. All rights reserved.