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

构建:

相关推荐
mzhan0177 小时前
[Linux] vdso 32bit vs 64bit
linux·运维·服务器
忧郁的橙子.7 小时前
26期_01_Pyhton linux基本命令
linux·运维·服务器
西京刀客7 小时前
macOS 打出来的 tar 包,Linux 常见告警(tar 包里带了 macOS 的扩展属性(xattr))
linux·运维·macos
我送炭你添花9 小时前
开源TR-069 ACS(自动配置服务器)GenieACS 的四个主要模块详细介绍
运维·服务器·开源
杭州杭州杭州9 小时前
Docker
运维·docker·容器
开开心心_Every9 小时前
Win10/Win11版本一键切换工具
linux·运维·服务器·edge·pdf·web3·共识算法
啟明起鸣9 小时前
【Nginx 网关开发】从源码分析 Nginx 的多进程启动原理
运维·nginx
怣5010 小时前
Linux创意命令组合:让终端变得有趣又高效
linux·运维·服务器
啟明起鸣10 小时前
【Nginx 网关开发】上手 Nginx,简简单单启动一个静态 html 页面
运维·c语言·前端·nginx·html
Tinyundg10 小时前
Linux系统分区
linux·运维·服务器