gpt4 book ai didi

Jenkinsfile 嵌套阶段抛出错误

转载 作者:行者123 更新时间:2023-12-03 14:03:00 32 4
gpt4 key购买 nike

我有以下我认为设置正确的 Jenkinsfile。我用过 https://jenkins.io/doc/book/pipeline/syntax/#sequential-stages作为一个例子,但出于某种原因,当我在 jenkins 中运行它时,我收到了,

WorkflowScript: 11: Unknown stage section "stages". Starting with version 0.5, steps in a stage must be in a steps block



有人可以告诉我我错过了什么或做错了什么吗?

pipeline {
agent {label 'windows'}

stages {
stage('Quick Build') {
steps {
echo 'Building'
}
}
stage('Deploy to Dev') {
// when {
// branch 'develop'
// }
stages {
stage('Building Distributable Package') {
steps {
echo 'Building'
}
}
stage('Archiving Package') {
steps {
echo 'Archiving Aritfacts'
archiveArtifacts artifacts: '/*.zip', fingerprint: true
}
}
stage('Deploying Dev') {
steps {
echo 'Deploying'
timeout(time:3, unit:'DAYS') {
input message: "Approve build?"
}
}
}
}

}
stage('Deploy to Test') {
when {
branch 'develop'
}
steps {
echo 'deploying..'
timeout(time:3, unit:'DAYS') {
input message: "Approve build?"
}
}
}
stage('Deploy to Prod') {
when {
branch 'release'
}
steps {
timeout(time:3, unit:'DAYS') {
input message: "Deploy to Prod?"
}
echo 'Deploying....'
}
}
}
}

提前致谢!

最佳答案

这最终成为版本 2.107.3 中的一个问题。升级到 2.121.2 后,此功能开始工作。

关于Jenkinsfile 嵌套阶段抛出错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51615925/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com