【发布时间】:2021-04-08 19:09:52
【问题描述】:
我尝试在我的 Jenkinsfile 上使用 sshCommand 并且已经安装了“SSH Pipeline Steps”插件, 但 Jenkins 构建错误:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: 60: Unknown stage section "sshCommand". Starting with version 0.5, steps in a stage must be in a ‘steps’ block. @ line 60, column 5.
stage('Remote SSH') {
^
WorkflowScript: 60: Multiple occurrences of the sshCommand section @ line 60, column 5.
stage('Remote SSH') {
^
WorkflowScript: 60: Unknown stage section "sshCommand". Starting with version 0.5, steps in a stage must be in a ‘steps’ block. @ line 60, column 5.
stage('Remote SSH') {
^
WorkflowScript: 60: Expected one of "steps", "stages", or "parallel" for stage "Remote SSH" @ line 60, column 5.
stage('Remote SSH') {
^
4 errors
这是我的詹金斯文件:
def remote = [name: "${host}", host: "${host}", user: "root", allowAnyHosts: true]
stage('Remote SSH') {
sshCommand remote: remote, command: "npm install"
sshCommand remote: remote, command: "npm run start"
}
这里已经安装好了:
【问题讨论】:
标签: jenkins ssh jenkins-pipeline jenkins-declarative-pipeline