Change: [JenkinsFile] allow easier configuration stages
This commit is contained in:
		
							
								
								
									
										39
									
								
								Jenkinsfile
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										39
									
								
								Jenkinsfile
									
									
									
									
										vendored
									
									
								
							@@ -1,19 +1,24 @@
 | 
				
			|||||||
#!/usr/bin/env groovy
 | 
					#!/usr/bin/env groovy
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def ci_checkers_targets = [
 | 
					// The stages we run one by one
 | 
				
			||||||
    ["commit-checker", "openttd/compile-farm-ci:commit-checker"],
 | 
					// Please don't add more than 2 items in a single stage; this hurts performance
 | 
				
			||||||
]
 | 
					def ci_stages = [
 | 
				
			||||||
def ci_builds_targets = [
 | 
					    "Checkers": [
 | 
				
			||||||
    ["linux-amd64-clang-3.8", "openttd/compile-farm-ci:linux-amd64-clang-3.8"],
 | 
					        "commit-checker": "openttd/compile-farm-ci:commit-checker",
 | 
				
			||||||
    ["linux-amd64-gcc-6", "openttd/compile-farm-ci:linux-amd64-gcc-6"],
 | 
					    ],
 | 
				
			||||||
    ["linux-i386-gcc-6", "openttd/compile-farm-ci:linux-i386-gcc-6"],
 | 
					    "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 {
 | 
					def generateStage(targets) {
 | 
				
			||||||
    ["${it[0]}" : generateCI(it[0], it[1])]
 | 
					    return targets.collectEntries{ key, target ->
 | 
				
			||||||
}
 | 
					        ["${key}": generateCI(key, target)]
 | 
				
			||||||
def ci_builds_stages = ci_builds_targets.collectEntries {
 | 
					    }
 | 
				
			||||||
    ["${it[0]}" : generateCI(it[0], it[1])]
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def generateCI(display_name, image_name) {
 | 
					def generateCI(display_name, image_name) {
 | 
				
			||||||
@@ -24,7 +29,7 @@ def generateCI(display_name, image_name) {
 | 
				
			|||||||
            dir("${display_name}") {
 | 
					            dir("${display_name}") {
 | 
				
			||||||
                unstash "source"
 | 
					                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 "docker logs --follow ${c.id}"
 | 
				
			||||||
                    sh "exit `docker wait ${c.id}`"
 | 
					                    sh "exit `docker wait ${c.id}`"
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
@@ -50,12 +55,10 @@ node {
 | 
				
			|||||||
            stash name: "source", useDefaultExcludes: false
 | 
					            stash name: "source", useDefaultExcludes: false
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        stage("Checkers") {
 | 
					        ci_stages.each { ci_stage ->
 | 
				
			||||||
            parallel ci_checkers_stages
 | 
					            stage(ci_stage.key) {
 | 
				
			||||||
 | 
					                parallel generateStage(ci_stage.value)
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					 | 
				
			||||||
        stage("Builds") {
 | 
					 | 
				
			||||||
           parallel ci_builds_stages
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user