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'
  }
}

构建:

相关推荐
叫致寒吧1 小时前
Nginx基于域名的虚拟主机实操案例
运维·服务器·nginx
施努卡机器视觉3 小时前
SNK施努卡车门自动化安装
运维·自动化
咕噜签名-铁蛋3 小时前
云服务器与物理服务器、VPS的区别
运维·服务器
恒创科技HK3 小时前
香港服务器流量有限制和带宽有限制区别在哪?
运维·服务器·网络
wanhengidc3 小时前
机架式服务器有什么作用?
运维·服务器·web安全·智能手机·云计算
干啥都是小小白3 小时前
Linux C编程
linux·运维·服务器
司铭鸿4 小时前
化学式解析的算法之美:从原子计数到栈的巧妙运用
linux·运维·服务器·算法·动态规划·代理模式·哈希算法
❀͜͡傀儡师4 小时前
docker部署orion-ops一站式运维管理平台
运维·docker·github
last demo4 小时前
MariaDB 数据库管理
linux·运维·服务器·数据库·php·mariadb
z***43845 小时前
SQL server配置ODBC数据源(本地和服务器)
运维·服务器·github