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

构建:

相关推荐
梁bk1 小时前
[Nginx]反向代理和负载均衡
运维·nginx·负载均衡
(:满天星:)7 小时前
第31篇:块设备与字符设备管理深度解析(基于OpenEuler 24.03)
linux·运维·服务器·网络·centos
小陶来咯7 小时前
【仿muduo库实现并发服务器】Acceptor模块
运维·服务器
cui_hao_nan7 小时前
Docker后端部署
运维·docker·容器
ZZH1120KQ8 小时前
Linux系统安全及应用
linux·运维·系统安全
小扎仙森8 小时前
关于服务器宝塔转移wordperss子比主题问题
运维·服务器
小小小糖果人9 小时前
Linux云计算基础篇(5)
linux·运维·服务器
我不是哆啦A梦9 小时前
破解风电运维“百模大战”困局,机械版ChatGPT诞生?
运维·人工智能·python·算法·chatgpt
weixin_7714323119 小时前
linux系统 weblogic10.3.6(jar) 下载及安装
linux·运维·jar
scuter_yu9 小时前
主流零信任安全产品深度介绍
运维·网络·安全