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

构建:

相关推荐
hmcjn(小何同学)4 分钟前
轻松Linux-9.进程间通信
linux·运维·服务器·c++·bash
上海达策TECHSONIC11 分钟前
经验分享:如何让SAP B1数据库性能提升50%
运维·数据库·运维开发
月光在发光16 分钟前
19_内核模块挂载问题处理
linux·运维·服务器
Liang_GaRy25 分钟前
心路历程-Linux如何赋予权限?
linux·运维·服务器
路溪非溪38 分钟前
Linux的gpio子系统
linux·运维·服务器
夫子39640 分钟前
OnlyOffice的高可用方案如何做
运维·架构
Linux运维技术栈1 小时前
Terraform 从入门到实战:历史、原理、功能与阿里云/Azure 上手指南
运维·阿里云·kubernetes·azure·terraform
wdfk_prog1 小时前
[Linux]学习笔记系列 -- lib/dump_stack.c 栈回溯打印(Stack Trace Dumping) 内核调试与错误诊断的基石
linux·运维·服务器·c语言·笔记·学习
不可能的是1 小时前
Docker与Ubuntu环境下apt-get报错完全解决指南
运维