Scripted jenkinsfile parallel stage

后端 未结 6 1618
星月不相逢
星月不相逢 2020-12-07 19:26

I am attempting to write a scripted Jenkinsfile using the groovy DSL which will have parallel steps within a set of stages.

Here is my jenkinsfile:

n         


        
6条回答
  •  情深已故
    2020-12-07 19:51

    Here's a simple example without loops or functions based on @Ed Randall's post:

    node('docker') {
        stage('unit test') {
            parallel([
                hello: {
                    echo "hello"
                },
                world: {
                    echo "world"
                }
            ])
        }
    
        stage('build') {
            def stages = [:]
    
            stages["mac"] = {
                echo "build for mac"
            }
            stages["linux"] = {
                echo "build for linux"
            }
    
            parallel(stages)
        }
    }
    

    ...which yields this:

    Note that the values of the Map don't need to be stages. You can give the steps directly.

提交回复
热议问题