代码之家  ›  专栏  ›  技术社区  ›  Grady D

Jenkinsfile嵌套阶段抛出错误

  •  0
  • Grady D  · 技术社区  · 7 年前

    我有以下的詹金斯文件,我相信是正确的设置。我用过 https://jenkins.io/doc/book/pipeline/syntax/#sequential-stages 作为一个例子,但由于某些原因,当我在jenkins运行这个程序时,

    工作流脚本:11:未知的阶段部分“阶段”。从 版本0.5,阶段中的步骤必须在步骤块中

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

    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....'
                }
            }
        }
    }
    

    提前谢谢!

    1 回复  |  直到 7 年前
        1
  •  5
  •   Grady D    7 年前

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