简体   繁体   中英

Running Jenkins job with different maven opts in parallel

community. I would like to run Jenkins job, same job but with diferent maven opts values and in parallel. How can i achieve that? I was trying to use different Jenkins plugins, but with no luck. Trying to configure pipelines using groovy scripts, but i am so amateur that i can't figure out how to achieve what i want. The goal is to run same jenkins job in parallel, but the only thing that must be different is environment where my tests should run. Maybe there is already a solution so you could point me to that.

You should be able to use parallel blocks for this. Following is a sample.

pipeline {
    agent none
    stages {
        stage('Run Tests') {
            parallel {
                stage('Test On Dev') {
                    agent {
                        label "IfYouwantToChangeAgent"
                    }
                    steps {
                        sh "mvn clean test -Dsomething=dev"
                    }
                    post {
                        always {
                            junit "**/TEST-*.xml"
                        }
                    }
                }
                stage('Test On QA') {
                    agent {
                        label "QA"
                    }
                    steps {
                        sh "mvn clean test -Dsomething=qa"
                    }
                    post {
                        always {
                            junit "**/TEST-*.xml"
                        }
                    }
                }
            }
        }
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM