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

构建:

相关推荐
zfxwasaboy1 天前
Linux宏clamp(val, lo, hi)的作用
linux·运维·服务器
apl3591 天前
论DevOps、平台工程的核心:配置管理与依赖管理
运维·devops
kida_yuan1 天前
【以太来袭】6. Besu 的 API 与调试体系
运维·区块链
李彦亮老师(本人)1 天前
【Linux系统】Rocky Linux 9.7操作系统简介
linux·运维·服务器·docker·kubernetes
minji...1 天前
Linux 进程信号(二)信号的保存,sigset_t,sigprocmask,sigpending
linux·运维·服务器·网络·数据结构·c++·算法
何中应1 天前
Grafana如何重置密码
linux·运维·服务器·grafana
贺小涛1 天前
jenkins
运维·jenkins
开开心心_Every1 天前
限时免费加密、隐藏、锁定文件文件夹好工具
运维·服务器·人工智能·edge·pdf·逻辑回归·深度优先
RisunJan1 天前
Linux命令-modprobe(自动处理可载入模块)
linux·运维