Sha*_*han 9 jenkins jenkins-pipeline
这是我正在尝试执行的Jenkins管道.我正在关注本教程:
pipeline {
agent any
stages {
stage('one') {
parallel "first" : {
echo "hello"
},
"second": {
echo "world"
}
}
stage('two') {
parallel "first" : {
echo "hello"
},
"second": {
echo "world"
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
但是这项工作失败了以下信息.
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: 4: Unknown stage section "parallel". Starting with version 0.5, steps in a stage must be in a steps block. @ line 4, column 9.
stage('one') {
^
WorkflowScript: 12: Unknown stage section "parallel". Starting with version 0.5, steps in a stage must be in a steps block. @ line 12, column 9.
stage('two') {
^
WorkflowScript: 4: Nothing to execute within stage "one" @ line 4, column 9.
stage('one') {
^
WorkflowScript: 12: Nothing to execute within stage "two" @ line 12, column 9.
stage('two') {
^
4 errors
Run Code Online (Sandbox Code Playgroud)
有人可以帮我解释为什么这会失败.
小智 25
您需要在阶段声明后添加步骤块.
pipeline {
agent any
stages {
stage('one') {
steps {
parallel("first": {
echo "hello"
},
"second": {
echo "world"
}
)
}
}
stage('two') {
steps {
parallel("first": {
echo "hello"
},
"second": {
echo "world"
}
)
}
}
}
}
Run Code Online (Sandbox Code Playgroud)