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

构建:

相关推荐
碳基沙盒21 小时前
OpenClaw 多 Agent 配置实战指南
运维
蝎子莱莱爱打怪4 天前
Centos7中一键安装K8s集群以及Rancher安装记录
运维·后端·kubernetes
埃博拉酱4 天前
VS Code Remote SSH 连接 Windows 服务器卡在"下载 VS Code 服务器":prcdn DNS 解析失败的诊断与 BITS 断点续传
windows·ssh·visual studio code
DianSan_ERP5 天前
电商API接口全链路监控:构建坚不可摧的线上运维防线
大数据·运维·网络·人工智能·git·servlet
呉師傅5 天前
火狐浏览器报错配置文件缺失如何解决#操作技巧#
运维·网络·windows·电脑
不是二师兄的八戒5 天前
Linux服务器挂载OSS存储的完整实践指南
linux·运维·服务器
zhangfeng11335 天前
趋动云 如何ssh登录 服务区 项目server
运维·人工智能·ssh
ZeroNews内网穿透5 天前
谷歌封杀OpenClaw背后:本地部署或是出路
运维·服务器·数据库·安全
失重外太空啦5 天前
nginx
运维·nginx
Gofarlic_oms15 天前
避免Kisssoft高级分析模块过度采购的科学评估方法
大数据·linux·运维·人工智能·matlab