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,87 +1,118 @@
// You can use http://job-dsl.herokuapp.com/ to validate the code before checkin // 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" def svnBase = "https://svn.apache.org/repos/asf/poi/trunk"
job('POI-DSL-Test') { def defaultJdks = ["1.6"]
description('<img src="http://poi.apache.org/resources/images/project-logo.jpg" />\n' +
'<p>\n' + def jdkMapping = [
'Apache POI - the Java API for Microsoft Documents\n' + "1.6": "JDK 1.6 (latest)",
'</p>\n' + "1.7": "JDK 1.7 (latest)",
'<p>\n' + "1.8": "JDK 1.8 (latest)",
' <b>This is an automatically generated Job Config, do not edit it here!\n' + "1.9": "JDK 1.9 (latest)",
' 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' + "OpenJDK": "OpenJDK xxx",
' 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' + poijobs.each { poijob ->
'<p>\n' +
' <b><a href="lastSuccessfulBuild/findbugsResult/" target="_blank">Findbugs report of latest build</a></b> -\n' + def jdks = poijob.jdks ?: defaultJdks
' <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' + jdks.each { jdkKey ->
'</p>\n') job('POI-DSL-Test') {
logRotator { description('<img src="http://poi.apache.org/resources/images/project-logo.jpg" />\n' +
numToKeep(5) '<p>\n' +
artifactNumToKeep(1) 'Apache POI - the Java API for Microsoft Documents\n' +
} '</p>\n' +
label('ubuntu&&!cloud-slave') '<p>\n' +
environmentVariables { ' <b>This is an automatically generated Job Config, do not edit it here!\n' +
env('LANG', 'en_US.UTF-8') ' 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' +
wrappers { ' for more details about the DSL.</b>\n' +
timeout { '</p>\n' +
absolute(180) '<p>\n' +
abortBuild() ' <b><a href="lastSuccessfulBuild/findbugsResult/" target="_blank">Findbugs report of latest build</a></b> -\n' +
writeDescription('Build was aborted due to timeout') ' <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')
jdk('JDK 1.6 (latest)') logRotator {
scm { numToKeep(5)
svn(svnBase) { svnNode -> artifactNumToKeep(1)
svnNode / browser(class: 'hudson.scm.browsers.ViewSVN') / }
url << 'http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN' label('ubuntu&&!cloud-slave')
} environmentVariables {
} env('LANG', 'en_US.UTF-8')
triggers { }
scm('H/15 * * * *') wrappers {
} timeout {
steps { absolute(180)
shell('# show which files are currently modified in the working copy\n' + abortBuild()
'svn status\n' + writeDescription('Build was aborted due to timeout')
'\n' + }
'# ignore any error message\n' + }
'exit 0') jdk(jdkMapping.get(jdkKey))
ant { scm {
targets(['clean', 'jenkins']) svn(svnBase) { svnNode ->
prop('coverage.enabled', true) svnNode / browser(class: 'hudson.scm.browsers.ViewSVN') /
antInstallation('Ant (latest)') url << 'http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN'
} }
ant { }
buildFile('src/integrationtest/build.xml') triggers {
antInstallation('Ant (latest)') scm('H/15 * * * *')
} }
} steps {
publishers { shell('# show which files are currently modified in the working copy\n' +
findbugs('build/findbugs.xml', false) { 'svn status\n' +
healthLimits(3, 20) '\n' +
thresholdLimit('low') '# ignore any error message\n' +
defaultEncoding('UTF-8') 'exit 0')
} ant {
archiveArtifacts('build/dist/*.tar.gz,build/findbugs.html,build/coverage/**,build/integration-test-results/**,ooxml-lib/**') targets(['clean', 'jenkins'])
warnings(['Java Compiler (javac)', 'JavaDoc Tool'], null) { prop('coverage.enabled', true)
resolveRelativePaths() antInstallation('Ant (latest)')
} }
archiveJunit('build/ooxml-test-results/*.xml,build/scratchpad-test-results/*.xml,build/test-results/*.xml,build/excelant-test-results/*.xml,build/integration-test-results/*.xml') { ant {
testDataPublishers { buildFile('src/integrationtest/build.xml')
publishTestStabilityData() antInstallation('Ant (latest)')
} }
} }
jacocoCodeCoverage { publishers {
classPattern('build/classes,build/examples-classes,build/excelant-classes,build/ooxml-classes,build/scratchpad-classes') findbugs('build/findbugs.xml', false) {
execPattern('build/*.exec') healthLimits(3, 20)
sourcePattern('src/java,src/excelant/java,src/ooxml/java,src/scratchpad/src') thresholdLimit('low')
exclusionPattern('com/microsoft/**,org/openxmlformats/**,org/etsi/**,org/w3/**,schemaorg*/**,schemasMicrosoft*/**,org/apache/poi/hdf/model/hdftypes/definitions/*.class,org/apache/poi/hwpf/model/types/*.class,org/apache/poi/hssf/usermodel/DummyGraphics2d.class,org/apache/poi/sl/draw/binding/*.class') defaultEncoding('UTF-8')
} }
configure { project -> archiveArtifacts('build/dist/*.tar.gz,build/findbugs.html,build/coverage/**,build/integration-test-results/**,ooxml-lib/**')
project / publishers << 'hudson.plugins.cigame.GamePublisher' {} warnings(['Java Compiler (javac)', 'JavaDoc Tool'], null) {
resolveRelativePaths()
}
archiveJunit('build/ooxml-test-results/*.xml,build/scratchpad-test-results/*.xml,build/test-results/*.xml,build/excelant-test-results/*.xml,build/integration-test-results/*.xml') {
testDataPublishers {
publishTestStabilityData()
}
}
jacocoCodeCoverage {
classPattern('build/classes,build/examples-classes,build/excelant-classes,build/ooxml-classes,build/scratchpad-classes')
execPattern('build/*.exec')
sourcePattern('src/java,src/excelant/java,src/ooxml/java,src/scratchpad/src')
exclusionPattern('com/microsoft/**,org/openxmlformats/**,org/etsi/**,org/w3/**,schemaorg*/**,schemasMicrosoft*/**,org/apache/poi/hdf/model/hdftypes/definitions/*.class,org/apache/poi/hwpf/model/types/*.class,org/apache/poi/hssf/usermodel/DummyGraphics2d.class,org/apache/poi/sl/draw/binding/*.class')
}
configure { project ->
project / publishers << 'hudson.plugins.cigame.GamePublisher' {}
}
mailer('dev@poi.apache.org', false, false)
}
} }
mailer('dev@poi.apache.org', false, false) }
}
} }