Running stages in parallel with Jenkins workflow / pipeline

前端 未结 5 636
渐次进展
渐次进展 2020-12-04 15:46

Please note: the question is based on the old, now called \"scripted\" pipeline format. When using \"declarative pipelines\", parallel blocks

5条回答
  •  甜味超标
    2020-12-04 16:07

    that syntax is now deprecated, you will get this error:

    org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
    WorkflowScript: 14: Expected a stage @ line 14, column 9.
           parallel firstTask: {
           ^
    
    WorkflowScript: 14: Stage does not have a name @ line 14, column 9.
           parallel secondTask: {
           ^
    
    2 errors
    

    You should do something like:

    stage("Parallel") {
        steps {
            parallel (
                "firstTask" : {
                    //do some stuff
                },
                "secondTask" : {
                    // Do some other stuff in parallel
                }
            )
        }
    }
    

    Just to add the use of node here, to distribute jobs across multiple build servers/ VMs:

    pipeline {
      stages {
        stage("Work 1"){
         steps{
          parallel ( "Build common Library":   
                {
                  node('

    All VMs should be labelled as to use as a pool.

提交回复
热议问题