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 小时前
Linux — 进程控制
android·linux·运维
JoneBB6 小时前
ABAP Webservice连接
运维·开发语言·数据库·学习
Tolalal6 小时前
Vmware Ubuntu虚拟机扩容
linux·运维·ubuntu
咚为7 小时前
比AccessLog更全面的原生Nginx 日志记录
运维·nginx·junit
我星期八休息7 小时前
Linux系统编程—基础IO
linux·运维·服务器·c语言·c++·人工智能·算法
a752066287 小时前
零基础实操:小龙虾 AI OpenClaw 接入 Kimi 详细步骤
运维·服务器
Goldbioinformatics8 小时前
Windows版Claude Cowork启动Linux问题
linux·运维·windows
念恒123068 小时前
Ext系列文件系统(下)
linux·运维·服务器
布吉岛的石头9 小时前
Docker Compose编排实战:多容器应用从开发到生产
运维·docker·容器