Skip to content

Instantly share code, notes, and snippets.

@akirakw
Last active August 15, 2019 21:39
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akirakw/42d834dab0a41153f844 to your computer and use it in GitHub Desktop.
Save akirakw/42d834dab0a41153f844 to your computer and use it in GitHub Desktop.
An example script of parallel test on Jenkins Workflow Plugin with Gradle project, based on plugin tutorial: https://github.com/jenkinsci/workflow-plugin/blob/master/TUTORIAL.md#creating-multiple-threads
node('remote') {
git url: 'https://github.com/akirakw/parallel-test-executor-plugin-sample.git' , branch: 'wip/gradle'
stash excludes: 'target/, build/', includes: '**', name: 'source'
}
def splits = splitTests([$class: 'CountDrivenParallelism', size: 2])
def branches = [:]
for (int i = 0; i < splits.size(); i++) {
def exclusions = splits.get(i);
branches["split${i}"] = {
node('remote') {
unstash 'source'
writeFile file: 'exclusions.txt', text: exclusions.join("\n")
sh "./gradlew -I ./exclusions.gradle clean check"
step([$class: 'JUnitResultArchiver', testResults: 'build/test-results/*.xml'])
}
}
}
parallel branches
@fabriciocolombo
Copy link

@akirakw Can you share the exclusions.gradle script?

@iftachsc
Copy link

did any of you got this working?

@imavroukakis
Copy link

@iftachsc yes, but heavily modified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment