在安装了 "ssh pipeline steps" 的 Jenkins 中找不到 sshCommand
sshCommand not found in Jenkins with "ssh pipeline steps" installed
我尝试在我的 Jenkinsfile 上使用 sshCommand,并且已经安装了“SSH Pipeline Steps”插件,
但是詹金斯构建错误:
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 Pipeline 的插件接口,则插件公开的函数或方法都必须包含在 steps
块中:
stage('Remote SSH') {
steps {
sshCommand remote: remote, command: "npm install"
sshCommand remote: remote, command: "npm run start"
}
}
您显示的错误将得到修复。
我尝试在我的 Jenkinsfile 上使用 sshCommand,并且已经安装了“SSH Pipeline Steps”插件, 但是詹金斯构建错误:
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 Pipeline 的插件接口,则插件公开的函数或方法都必须包含在 steps
块中:
stage('Remote SSH') {
steps {
sshCommand remote: remote, command: "npm install"
sshCommand remote: remote, command: "npm run start"
}
}
您显示的错误将得到修复。