From 43338b8a4572f3bc8c53338f0bff5afe9c225c8a Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Sat, 14 Apr 2018 16:49:11 +0200 Subject: Change: [JenkinsFile] allow easier configuration stages --- Jenkinsfile | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) (limited to 'Jenkinsfile') diff --git a/Jenkinsfile b/Jenkinsfile index 0717b286c..095425a73 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,19 +1,24 @@ #!/usr/bin/env groovy -def ci_checkers_targets = [ - ["commit-checker", "openttd/compile-farm-ci:commit-checker"], -] -def ci_builds_targets = [ - ["linux-amd64-clang-3.8", "openttd/compile-farm-ci:linux-amd64-clang-3.8"], - ["linux-amd64-gcc-6", "openttd/compile-farm-ci:linux-amd64-gcc-6"], - ["linux-i386-gcc-6", "openttd/compile-farm-ci:linux-i386-gcc-6"], +// The stages we run one by one +// Please don't add more than 2 items in a single stage; this hurts performance +def ci_stages = [ + "Checkers": [ + "commit-checker": "openttd/compile-farm-ci:commit-checker", + ], + "Compilers": [ + "linux-amd64-gcc-6": "openttd/compile-farm-ci:linux-amd64-gcc-6", + "linux-amd64-clang-3.8": "openttd/compile-farm-ci:linux-amd64-clang-3.8", + ], + "Archs": [ + "linux-i386-gcc-6": "openttd/compile-farm-ci:linux-i386-gcc-6", + ], ] -def ci_checkers_stages = ci_checkers_targets.collectEntries { - ["${it[0]}" : generateCI(it[0], it[1])] -} -def ci_builds_stages = ci_builds_targets.collectEntries { - ["${it[0]}" : generateCI(it[0], it[1])] +def generateStage(targets) { + return targets.collectEntries{ key, target -> + ["${key}": generateCI(key, target)] + } } def generateCI(display_name, image_name) { @@ -24,7 +29,7 @@ def generateCI(display_name, image_name) { dir("${display_name}") { unstash "source" - docker.image("${image_name}").withRun("--volumes-from ${hostname} --workdir " + pwd()) { c-> + docker.image("${image_name}").withRun("--volumes-from ${hostname} --workdir " + pwd()) { c -> sh "docker logs --follow ${c.id}" sh "exit `docker wait ${c.id}`" } @@ -50,12 +55,10 @@ node { stash name: "source", useDefaultExcludes: false } - stage("Checkers") { - parallel ci_checkers_stages - } - - stage("Builds") { - parallel ci_builds_stages + ci_stages.each { ci_stage -> + stage(ci_stage.key) { + parallel generateStage(ci_stage.value) + } } } } -- cgit v1.2.3-70-g09d2