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

构建:

相关推荐
likfishdn9 分钟前
Linux的文件与目录管理
linux·运维·服务器
chian-ocean29 分钟前
Linux 文件缓冲区:高效数据访问的幕后推手
linux·运维·服务器
加油=^_^=31 分钟前
【Linux】进程优先级 | 进程调度(三)
linux·运维·服务器
元气满满的热码式1 小时前
Docker数据卷操作实战
linux·运维·docker·云原生·容器
北京耐用通信1 小时前
航空装配自动化神器Ethercat转profient网关搭配机器人精准控制
运维·机器人·自动化
吃汤圆的抹香鲸2 小时前
Rider 安装包 绿色版 Win/Mac/Linux 适合.NET和游戏开发者使用 2025全栈开发终极指南:从零配置到企业级实战
linux·运维·windows·sql·游戏·macos·.net
那片海还在吗4 小时前
使用 Git、Postman、Newman、Jenkins 与邮件构建自动化接口测试及通知流程
git·jenkins·postman
崔lc4 小时前
linux中安装部署Jenkins,成功构建springboot项目详细教程
运维·jenkins
luojiaao4 小时前
【Jenkins】个人向-Jenkinsfile如何写
运维·jenkins
wanhengidc8 小时前
单线服务器和双线服务器分别是指什么?
运维·服务器