詹金斯管道文件

Jenkins Pipeline file

我正在编写一个声明性的 jenkinsfile 来构建一个管道项目。一些阶段中的一些步骤将需要一些远程命令 运行。远程 ssh 站点已在主 jenkins 配置中配置。

如何在我的 jenkinsfile 中声明这些步骤?我知道我可以 运行 shell 在本地使用 sh 命令,但我需要知道的是远程服务器?

您需要安装 ssh-agent plugin then you will be able to execute remote commands using ssh. Check this for examples