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

构建:

相关推荐
loong_XL4 小时前
docker gpu容器镜像环境构建
运维·docker·容器
杨了个杨89825 小时前
nginx常见功能部署
运维·服务器·nginx
小天源6 小时前
linux漏洞一键扫描
linux·运维·服务器·漏洞扫描
eWidget7 小时前
InfluxDB迁移至金仓数据库的同城容灾实践:性能显著提升、运维效率优化,某能源企业实现RPO_5秒的高可靠时序数据管理
运维·数据库·能源·时序数据库·kingbase·kingbasees·金仓数据库
m0_696212687 小时前
个人微信api
运维·服务器
en-route7 小时前
SSH Key 与 GPG Key 区别详解:Git 使用中的身份与签名机制
运维·git·ssh
小白鸽i10 小时前
【LINUX】将源码驱动文件编译并生效
linux·运维·服务器
做萤石二次开发的哈哈10 小时前
萤石开放平台 音视频 | 产品概述
运维·服务器·萤石云·萤石·萤石开放平台
0思必得010 小时前
[Web自动化] 处理爬虫异常
运维·爬虫·python·selenium·自动化·web自动化
China_Yanhy11 小时前
我的区块链运维日记 · 第 4 日:死掉的“活”节点 —— 攻克“同步滞后(Lag)”
运维·区块链