Jenkins声明式顺序管道

时间:2018-06-20 14:38:38

标签: jenkins jenkins-pipeline sequential declarative

为什么这不起作用? (https://jenkins.io/doc/book/pipeline/syntax/#sequential-stages) 我用以下内容创建了一个管道...

pipeline {
agent none
stages {
    stage('Non-Sequential Stage') {
        agent {
            label 'for-non-sequential'
        }
        steps {
            echo "On Non-Sequential Stage"
        }
    }
    stage('Sequential') {
        agent {
            label 'for-sequential'
        }
        environment {
            FOR_SEQUENTIAL = "some-value"
        }
        stages {
           stage('In Sequential 1') {
               steps {
                   echo "In Sequential 1"
               }
           }
           stage('In Sequential 2') {
               steps {
                   echo "In Sequential 2"
               }
           }
        }
    }
}

}

我得到以下内容

  

org.codehaus.groovy.control.MultipleCompilationErrorsException:   启动失败:WorkflowScript:12:未知阶段部分“阶段”。   从版本0.5开始,阶段中的步骤必须位于步骤块中。   @第12行,第9列。              stage('Sequential'){              ^

     

WorkflowScript:12:在阶段内无需执行任何“步骤”或“并行”   “顺序” @第12行,第9列。              stage('Sequential'){              ^

     

2个错误

     在

  org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310)     在   org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1085)     在   org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:603)     在   org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:581)     在   org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:558)     在   groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)     在   groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)     在groovy.lang.GroovyShell.parseClass(GroovyShell.java:688)在   groovy.lang.GroovyShell.parse(GroovyShell.java:700)在   org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.doParse(CpsGroovyShell.java:131)     在   org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:125)     在   org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:560)     在   org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:521)     在   org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:325)     在   hudson.model.ResourceController.execute(ResourceController.java:97)     在hudson.model.Executor.run(Executor.java:429)处完成:失败

0 个答案:

没有答案