我试图在声明式Jenkins流水线中定义一个并行段落。
我基于这个语法:https://jenkins.io/blog/2017/09/25/declarative-1/ 但我得到了这个错误:
我基于这个语法:https://jenkins.io/blog/2017/09/25/declarative-1/ 但我得到了这个错误:
WorkflowScript: 74: Expected one of "steps", "stages", or "parallel" for stage "app cores" @ line 74, column 3.
stage('bat cores') {
^
我尝试过移动并行块,但是这样会导致其他错误。就我所知,我的代码与上面的博客帖子相匹配。
有什么建议吗?
版本:
- Jenkins 版本 2.138.1
- Pipeline: Declarative 版本 1.3.2
我的完整管道如下所示:
pipeline {
agent { label 'master' }
options {
ansiColor('xterm')
}
parameters {
choice(name: 'STOP_ON_FIRST_FAILURE', choices: ['true', 'false'], description: '....')
choice(name: 'RUN_MODE', choices: [
'plan, confirm, apply',
'plan, confirm, apply, then destroy',
'destroy'],
description: "Choose to destroy resources at end" )
string(name: 'GIT_REPO_BRANCH', defaultValue: 'production', description: '...')
}
stages {
stage('thing container') {
steps {
build job: '/DevWork/DT/production branch/FA1/FA1 thing Creation', propagate: params.STOP_ON_FIRST_FAILURE
}
}
stage('bat cores') {
steps {
build(
job: '/DevWork/DT/production branch/FA1/FA1 thing Creation',
propagate: params.STOP_ON_FIRST_FAILURE,
parameters: [
[$class: 'StringParameterValue', name: 'RUN_MODE', value: params.RUN_MODE],
[$class: 'StringParameterValue', name: 'GIT_REPO_BRANCH', value: params.GIT_REPO_BRANCH],
]
)
build(
job: '/DevWork/DT/production branch/FA1/FA103/FA103 bat Core',
propagate: params.STOP_ON_FIRST_FAILURE,
parameters: [
[$class: 'StringParameterValue', name: 'RUN_MODE', value: params.RUN_MODE],
[$class: 'StringParameterValue', name: 'GIT_REPO_BRANCH', value: params.GIT_REPO_BRANCH],
]
)
build(
job: '/DevWork/DT/production branch/FA1/FA104/FA104 bat Core',
propagate: params.STOP_ON_FIRST_FAILURE,
parameters: [
[$class: 'StringParameterValue', name: 'RUN_MODE', value: params.RUN_MODE],
[$class: 'StringParameterValue', name: 'GIT_REPO_BRANCH', value: params.GIT_REPO_BRANCH],
]
)
build(
job: '/DevWork/DT/production branch/FA1/FA101/FA101 bat Core',
propagate: params.STOP_ON_FIRST_FAILURE,
parameters: [
[$class: 'StringParameterValue', name: 'RUN_MODE', value: params.RUN_MODE],
[$class: 'StringParameterValue', name: 'GIT_REPO_BRANCH', value: params.GIT_REPO_BRANCH],
]
)
build(
job: '/DevWork/DT/production branch/FA1/FA102/FA102 bat Core',
propagate: params.STOP_ON_FIRST_FAILURE,
parameters: [
[$class: 'StringParameterValue', name: 'RUN_MODE', value: params.RUN_MODE],
[$class: 'StringParameterValue', name: 'GIT_REPO_BRANCH', value: params.GIT_REPO_BRANCH],
]
)
}
}
stage('app cores') {
steps {
parallel {
stage('FA10302 Application Core') {
steps {
build(
job: '/DevWork/DT/production branch/FA1/FA103/FA10302 Application Core',
propagate: params.STOP_ON_FIRST_FAILURE,
parameters: [
[$class: 'StringParameterValue', name: 'RUN_MODE', value: params.RUN_MODE],
[$class: 'StringParameterValue', name: 'GIT_REPO_BRANCH', value: params.GIT_REPO_BRANCH],
]
)
}
}
stage('FA10301 Application Core') {
steps {
build(
job: '/DevWork/DT/production branch/FA1/FA103/FA10301 Application Core',
propagate: params.STOP_ON_FIRST_FAILURE,
parameters: [
[$class: 'StringParameterValue', name: 'RUN_MODE', value: params.RUN_MODE],
[$class: 'StringParameterValue', name: 'GIT_REPO_BRANCH', value: params.GIT_REPO_BRANCH],
]
)
}
}
stage('FA10101 Application Core') {
steps {
build(
job: '/DevWork/DT/production branch/FA1/FA101/FA10101 Application Core',
propagate: params.STOP_ON_FIRST_FAILURE,
parameters: [
[$class: 'StringParameterValue', name: 'RUN_MODE', value: params.RUN_MODE],
[$class: 'StringParameterValue', name: 'GIT_REPO_BRANCH', value: params.GIT_REPO_BRANCH],
]
)
}
}
}
}
}
}
}
stage('bat cores')
明显不在第74行。 - Matt Schuchard