Jenkins 流水线pipeline中SSH方式登录远程机器

1.在jenkins上安装SSHpipeline Step Plugins

2.scripts

pipeline{

   agent any

   stages {

       stage ('Pipeline configuration') {

                agent none

                steps {

                      script {

                        stage ('Pull & PushImage') {

                          def remote = [:]

                          remote.name = 'test'

                          remote.host ='192.168.248.190'

                          remote.user = 'root'

                          remote.password ='password'

                          remote.allowAnyHosts= true

                          writeFile file:'jemeter.sh', text: 'cd /ibm \n ls'

                          sshScript remote: remote,script: "jemeter.sh"

                            }

                       }

                  }   

           }

      }

}



作者:sckehan
链接:https://www.jianshu.com/p/e8a4fdef1805
来源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。

猜你喜欢

转载自blog.csdn.net/tojava/article/details/93843768