jenkins 插件SSH Pipeline Steps

一、安装

SSH Pipeline Steps | Jenkins plugin

二、添加全局linux服务器用户名密码:linux-142

三、新建流水线SshServer

添加Pipeline Script

javascript 复制代码
node {
  def remote = [:]
  remote.name = 'tst'
  remote.host = '192.168.31.142'
  remote.allowAnyHosts = true
  withCredentials([usernamePassword(credentialsId: 'linux-142', passwordVariable: 'PASSWORD', usernameVariable: 'USERNAME')]) {
    remote.user = "${USERNAME}"
    remote.password = "${PASSWORD}"
  }
  stage('Remote SSH') {
     sshCommand remote: remote, command: 'for i in {1..5}; do echo -n \"Loop \$i \"; date ; sleep 1; done'
  }
  stage('Remote SSH2') {
     sshCommand remote: remote, command: 'for i in {1..5}; do echo -n \"Loop \$i \"; date ; sleep 1; done'
  }
}

构建:

相关推荐
皮小白5 分钟前
ubuntu开机检查磁盘失败进入应急模式如何修复
linux·运维·ubuntu
邂逅星河浪漫20 分钟前
【CentOS】虚拟机网卡IP地址修改步骤
linux·运维·centos
IT逆夜1 小时前
实现Yum本地仓库自动同步的完整方案(CentOS 7)
linux·运维·windows
a***59261 小时前
用nginx正向代理https网站
运维·nginx·https
S***26751 小时前
linux上redis升级
linux·运维·redis
ifanatic2 小时前
[每周一更]-(第161期):分析服务器中内存即将爆满过程
运维·服务器
热爱学习的小怪兽2 小时前
docker的一些常用指令
运维·docker·容器
s***4533 小时前
Linux 下安装 Golang环境
linux·运维·golang
JobDocLS3 小时前
Ubuntu22.04的安装方法
运维
豆豆的java之旅4 小时前
深入浅出Activity工作流:从理论到实践,让业务流转自动化
java·运维·自动化·activity·工作流