Jenkins DSL: Start adding multiple Jobs with re-use of common parts

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1772253 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dominik Stadler 2016-12-01 19:09:26 +00:00
parent db4b73a8c1
commit 63943b7d31

View File

@ -1,22 +1,51 @@
// You can use http://job-dsl.herokuapp.com/ to validate the code before checkin
//
def poijobs = [
[
name: 'POI-DSL',
jdks: ["1.6","1.8","OpenJDK"]
],
[
name: 'POI-DSL-OpenJDK'
],
[
name: 'POI-DSL-no-scratchpad'
],
]
def svnBase = "https://svn.apache.org/repos/asf/poi/trunk"
job('POI-DSL-Test') {
def defaultJdks = ["1.6"]
def jdkMapping = [
"1.6": "JDK 1.6 (latest)",
"1.7": "JDK 1.7 (latest)",
"1.8": "JDK 1.8 (latest)",
"1.9": "JDK 1.9 (latest)",
"OpenJDK": "OpenJDK xxx",
]
poijobs.each { poijob ->
def jdks = poijob.jdks ?: defaultJdks
jdks.each { jdkKey ->
job('POI-DSL-Test') {
description('<img src="http://poi.apache.org/resources/images/project-logo.jpg" />\n' +
'<p>\n' +
'Apache POI - the Java API for Microsoft Documents\n' +
'</p>\n' +
'<p>\n' +
' <b>This is an automatically generated Job Config, do not edit it here!\n' +
' Instead change the Jenkins Job DSL at <a href="http://svn.apache.org/repos/asf/poi/trunk/jenkins">http://svn.apache.org/repos/asf/poi/trunk/jenkins</a>,\n' +
' see <a href="https://github.com/jenkinsci/job-dsl-plugin/wiki">https://github.com/jenkinsci/job-dsl-plugin/wiki</a>\n' +
' for more details about the DSL.</b>\n' +
'</p>\n' +
'<p>\n' +
' <b><a href="lastSuccessfulBuild/findbugsResult/" target="_blank">Findbugs report of latest build</a></b> -\n' +
' <b><a href="https://analysis.apache.org/dashboard/index/221489" target="_blank">Sonar reports</a></b> -\n' +
' <b><a href="lastSuccessfulBuild/artifact/build/coverage/index.html" target="_blank">Coverage of latest build</a></b>\n' +
'</p>\n')
'<p>\n' +
'Apache POI - the Java API for Microsoft Documents\n' +
'</p>\n' +
'<p>\n' +
' <b>This is an automatically generated Job Config, do not edit it here!\n' +
' Instead change the Jenkins Job DSL at <a href="http://svn.apache.org/repos/asf/poi/trunk/jenkins">http://svn.apache.org/repos/asf/poi/trunk/jenkins</a>,\n' +
' see <a href="https://github.com/jenkinsci/job-dsl-plugin/wiki">https://github.com/jenkinsci/job-dsl-plugin/wiki</a>\n' +
' for more details about the DSL.</b>\n' +
'</p>\n' +
'<p>\n' +
' <b><a href="lastSuccessfulBuild/findbugsResult/" target="_blank">Findbugs report of latest build</a></b> -\n' +
' <b><a href="https://analysis.apache.org/dashboard/index/221489" target="_blank">Sonar reports</a></b> -\n' +
' <b><a href="lastSuccessfulBuild/artifact/build/coverage/index.html" target="_blank">Coverage of latest build</a></b>\n' +
'</p>\n')
logRotator {
numToKeep(5)
artifactNumToKeep(1)
@ -32,7 +61,7 @@ job('POI-DSL-Test') {
writeDescription('Build was aborted due to timeout')
}
}
jdk('JDK 1.6 (latest)')
jdk(jdkMapping.get(jdkKey))
scm {
svn(svnBase) { svnNode ->
svnNode / browser(class: 'hudson.scm.browsers.ViewSVN') /
@ -44,10 +73,10 @@ job('POI-DSL-Test') {
}
steps {
shell('# show which files are currently modified in the working copy\n' +
'svn status\n' +
'\n' +
'# ignore any error message\n' +
'exit 0')
'svn status\n' +
'\n' +
'# ignore any error message\n' +
'exit 0')
ant {
targets(['clean', 'jenkins'])
prop('coverage.enabled', true)
@ -84,4 +113,6 @@ job('POI-DSL-Test') {
}
mailer('dev@poi.apache.org', false, false)
}
}
}
}