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

构建:

相关推荐
夜月yeyue2 小时前
Linux 调度类(sched_class)
linux·运维·c语言·单片机·性能优化
林义满2 小时前
运维转型让产线 “少掉链”:上海义满汽车零部件借智能运维降本增效,年减损失超 200 万
运维·汽车
VekiSon3 小时前
Linux系统编程——IPC进程间通信:信号通信与共享内存
linux·运维·服务器
南山nash3 小时前
CentOs7 安装 Docker 详细步骤
linux·运维·docker·容器
ZHHHHHJ663 小时前
LL层-PAST
运维·服务器·网络
fufu03114 小时前
Linux环境下的C语言编程(四十六)
linux·运维·服务器
qq_418247884 小时前
Linux上部署conda环境
linux·运维·神经网络·机器学习·conda
UVM_ERROR4 小时前
RDMA Scheduler + TX + Completion RTL 开发经验分享
笔记·vscode·ssh·github·芯片
行走的领路人5 小时前
同步服务器时间
运维·服务器
_F_y6 小时前
Linux:多线程
linux·运维·服务器