You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

create_jobs.groovy 29KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705
  1. // This script is used as input to the Jenkins Job DSL plugin to create all the build-jobs that
  2. // Apache POI uses on the public Jenkins instance at https://builds.apache.org/view/P/view/POI/
  3. //
  4. // See https://github.com/jenkinsci/job-dsl-plugin/wiki for information about the DSL, you can
  5. // use http://job-dsl.herokuapp.com/ to validate the code before checkin
  6. //
  7. def triggerSundays = '''
  8. # only run this once per week on Sundays
  9. H H * * 0
  10. '''
  11. def xercesUrl = 'http://repo1.maven.org/maven2/xerces/xercesImpl/2.6.1/xercesImpl-2.6.1.jar'
  12. def xercesLib = './xercesImpl-2.6.1.jar'
  13. def poijobs = [
  14. [ name: 'POI-DSL-1.8', trigger: 'H */12 * * *'
  15. ],
  16. [ name: 'POI-DSL-OpenJDK', jdk: 'OpenJDK', trigger: 'H */12 * * *',
  17. // H13-H20 (Ubuntu 16.04) do not have OpenJDK 6 installed, see https://issues.apache.org/jira/browse/INFRA-12880
  18. slaveAdd: '&&!beam1&&!beam2&&!beam3&&!beam4&&!beam5&&!beam6&&!beam7&&!beam8' +
  19. '&&!H0&&!H1&&!H2&&!H3&&!H4&&!H5&&!H6&&!H7&&!H8&&!H9&&!H10&&!H11' +
  20. '&&!qnode3' +
  21. '&&!ubuntu-1&&!ubuntu-2&&!ubuntu-4&&!ubuntu-5&&!ubuntu-6&&!ubuntu-eu2&&!ubuntu-us1',
  22. // the JDK is missing on some slaves so builds are unstable
  23. skipcigame: true
  24. ],
  25. [ name: 'POI-DSL-1.10', jdk: '1.10', trigger: triggerSundays,
  26. properties: ['-Djava9addmods=--add-modules=java.xml.bind',
  27. '-Djavadoc9addmods=--add-modules=java.xml.bind',
  28. '-Djava9addmodsvalue=-Dsun.reflect.debugModuleAccessChecks=true',
  29. '-Djava9addopens1=--add-opens=java.xml/com.sun.org.apache.xerces.internal.util=ALL-UNNAMED',
  30. '-Djava9addopens2=--add-opens=java.base/java.io=ALL-UNNAMED',
  31. '-Djava9addopens3=--add-opens=java.base/java.nio=ALL-UNNAMED',
  32. '-Djava9addopens4=--add-opens=java.base/java.lang=ALL-UNNAMED',
  33. '-Djava9addopens5=--add-opens=java.base/jdk.internal.ref=ALL-UNNAMED',
  34. '-Djava9addopens6=--add-opens=java.base/java.lang=java.xml.bind',
  35. '-Djava.locale.providers=JRE,CLDR'],
  36. skipcigame: true
  37. ],
  38. [ name: 'POI-DSL-1.11', jdk: '1.11', trigger: triggerSundays,
  39. // Nodes beam* do not yet have JDK 11 installed
  40. slaveAdd: '&&!beam1&&!beam2&&!beam3&&!beam4&&!beam6&&!beam7&&!beam8&&!beam9&&!beam10&&!beam11&&!beam12&&!beam13&&!beam14&&!beam15&&!beam16',
  41. properties: ['-Djava9addmodsvalue=-Dsun.reflect.debugModuleAccessChecks=true',
  42. '-Djava9addopens1=--add-opens=java.xml/com.sun.org.apache.xerces.internal.util=ALL-UNNAMED',
  43. '-Djava9addopens2=--add-opens=java.base/java.io=ALL-UNNAMED',
  44. '-Djava9addopens3=--add-opens=java.base/java.nio=ALL-UNNAMED',
  45. '-Djava9addopens4=--add-opens=java.base/java.lang=ALL-UNNAMED',
  46. '-Djava9addopens5=--add-opens=java.base/jdk.internal.ref=ALL-UNNAMED',
  47. '-Djava.locale.providers=JRE,CLDR'],
  48. skipcigame: true
  49. ],
  50. [ name: 'POI-DSL-1.12', jdk: '1.12', trigger: triggerSundays,
  51. // Nodes beam* do not yet have JDK 12 installed
  52. slaveAdd: '&&!beam1&&!beam2&&!beam3&&!beam4&&!beam6&&!beam7&&!beam8&&!beam9&&!beam10&&!beam11&&!beam12&&!beam13&&!beam14&&!beam15&&!beam16',
  53. properties: ['-Djava9addmodsvalue=-Dsun.reflect.debugModuleAccessChecks=true',
  54. '-Djava9addopens1=--add-opens=java.xml/com.sun.org.apache.xerces.internal.util=ALL-UNNAMED',
  55. '-Djava9addopens2=--add-opens=java.base/java.io=ALL-UNNAMED',
  56. '-Djava9addopens3=--add-opens=java.base/java.nio=ALL-UNNAMED',
  57. '-Djava9addopens4=--add-opens=java.base/java.lang=ALL-UNNAMED',
  58. '-Djava9addopens5=--add-opens=java.base/jdk.internal.ref=ALL-UNNAMED',
  59. '-Djava.locale.providers=JRE,CLDR'],
  60. skipcigame: true
  61. ],
  62. [ name: 'POI-DSL-IBM-JDK', jdk: 'IBMJDK', trigger: triggerSundays, skipcigame: true
  63. ],
  64. [ name: 'POI-DSL-old-Xerces', trigger: triggerSundays,
  65. shell: "test -f ${xercesLib} || wget -O ${xercesLib} ${xercesUrl}\n",
  66. // the property triggers using Xerces as XML Parser and previously showed some exception that can occur
  67. properties: ["-Dadditionaljar=${xercesLib}"]
  68. ],
  69. [ name: 'POI-DSL-Maven', trigger: 'H */4 * * *', maven: true
  70. ],
  71. [ name: 'POI-DSL-regenerate-javadoc', trigger: triggerSundays, javadoc: true
  72. ],
  73. // disabled for 4.0.0 because we break compatibility on-purpose in a few places, e.g. for Java 9 compatibility
  74. [ name: 'POI-DSL-API-Check', trigger: '@daily', apicheck: true, disabled: true
  75. ],
  76. [ name: 'POI-DSL-Gradle', trigger: triggerSundays, email: 'centic@apache.org', gradle: true,
  77. // Gradle will not run any tests if the code is up-to-date, therefore manually mark the files as updated
  78. addShell: 'touch --no-create build/*/build/test-results/TEST-*.xml build/*/build/test-results/test/TEST-*.xml'
  79. ],
  80. [ name: 'POI-DSL-no-scratchpad', trigger: triggerSundays, noScratchpad: true
  81. ],
  82. [ name: 'POI-DSL-SonarQube', trigger: 'H 9 * * *', maven: true, sonar: true, skipcigame: true
  83. ],
  84. [ name: 'POI-DSL-SonarQube-Gradle', trigger: 'H 9 * * *', gradle: true, sonar: true, skipcigame: true,
  85. disabled: true // this one does run, but does not actually send data to Sonarqube for some reason, we need to investigate some more
  86. ],
  87. [ name: 'POI-DSL-Windows-1.8', trigger: 'H */12 * * *', windows: true, slaves: 'Windows'
  88. ],
  89. [ name: 'POI-DSL-Github-PullRequests', trigger: '', githubpr: true, skipcigame: true,
  90. // ensure the file which is needed from the separate documentation module does exist
  91. // as we are checking out from git, we do not have the reference checked out here
  92. addShell: 'mkdir src/documentation\ntouch src/documentation/RELEASE-NOTES.txt'
  93. ],
  94. ]
  95. def xmlbeansjobs = [
  96. [ name: 'POI-XMLBeans-DSL-1.6', jdk: '1.6', trigger: 'H */12 * * *', skipcigame: true,
  97. ],
  98. [ name: 'POI-XMLBeans-DSL-1.8', jdk: '1.8', trigger: triggerSundays, skipcigame: true,
  99. ],
  100. [ name: 'POI-XMLBeans-DSL-1.11', jdk: '1.11', trigger: triggerSundays, skipcigame: true,
  101. disabled: true // XMLBeans does not yet compile with Java 11
  102. ]
  103. ]
  104. def svnBase = 'https://svn.apache.org/repos/asf/poi/trunk'
  105. def xmlbeansSvnBase = 'https://svn.apache.org/repos/asf/xmlbeans/trunk'
  106. def defaultJdk = '1.8'
  107. def defaultTrigger = 'H/15 * * * *' // check SCM every 60/15 = 4 minutes
  108. def defaultEmail = 'dev@poi.apache.org'
  109. def defaultAnt = 'Ant 1.9.9'
  110. // currently a lot of H?? slaves don't have Ant installed ... H21 seems to have a SVN problem
  111. // H35 fails with ImageIO create cache file errors, although the java.io.tmpdir is writable
  112. def defaultSlaves = '(ubuntu||beam)&&!cloud-slave&&!H15&&!H17&&!H18&&!H24&&!ubuntu-4&&!H21&&!H35'
  113. def jdkMapping = [
  114. '1.6': 'JDK 1.6 (latest)',
  115. '1.8': 'JDK 1.8 (latest)',
  116. '1.10': 'JDK 10 (latest)',
  117. '1.11': 'JDK 11 (latest)',
  118. '1.12': 'JDK 12 (latest)',
  119. 'OpenJDK': 'OpenJDK 8 (on Ubuntu only) ', // blank is required here until the name in the Jenkins instance is fixed!
  120. 'IBMJDK': 'IBM 1.8 64-bit (on Ubuntu only)',
  121. ]
  122. static def shellEx(def context, String cmd, def poijob) {
  123. if (poijob.windows) {
  124. context.batchFile(cmd)
  125. } else {
  126. context.shell(cmd)
  127. }
  128. }
  129. def defaultDesc = '''
  130. <img src="https://poi.apache.org/images/project-header.png" />
  131. <p>
  132. Apache POI - the Java API for Microsoft Documents
  133. </p>
  134. <p>
  135. <b>This is an automatically generated Job Config, do not edit it here!
  136. Instead change the Jenkins Job DSL at <a href="https://svn.apache.org/repos/asf/poi/trunk/jenkins">https://svn.apache.org/repos/asf/poi/trunk/jenkins</a>,
  137. see <a href="https://github.com/jenkinsci/job-dsl-plugin/wiki">https://github.com/jenkinsci/job-dsl-plugin/wiki</a>
  138. for more details about the DSL.</b>
  139. </p>'''
  140. def apicheckDesc = '''
  141. <p>
  142. <b><a href="https://builds.apache.org/analysis/dashboard?id=org.apache.poi%3Apoi-parent&did=1" target="_blank">Sonar reports</a></b> -
  143. <p>
  144. <b><a href="lastSuccessfulBuild/artifact/build/main/build/reports/japi.html">API Check POI</a></b>
  145. <b><a href="lastSuccessfulBuild/artifact/build/ooxml/build/reports/japi.html">API Check POI-OOXML</a></b>
  146. <b><a href="lastSuccessfulBuild/artifact/build/excelant/build/reports/japi.html">API Check POI-Excelant</a></b>
  147. <b><a href="lastSuccessfulBuild/artifact/build/scratchpad/build/reports/japi.html">API Check POI-Scratchpad</a></b>
  148. </p>
  149. '''
  150. def sonarDesc = '''
  151. <p>
  152. <b><a href="lastSuccessfulBuild/findbugsResult/" target="_blank">Findbugs report of latest build</a></b> -
  153. <b><a href="https://builds.apache.org/analysis/dashboard?id=org.apache.poi%3Apoi-parent&did=1" target="_blank">Sonar reports</a></b> -
  154. <b><a href="lastSuccessfulBuild/artifact/build/coverage/index.html" target="_blank">Coverage of latest build</a></b>
  155. </p>
  156. '''
  157. def shellCmdsUnix =
  158. '''# show which files are currently modified in the working copy
  159. svn status
  160. # print out information about which exact version of java we are using
  161. echo Java-Home: $JAVA_HOME
  162. ls -al $JAVA_HOME/
  163. ls -al $JAVA_HOME/bin
  164. $JAVA_HOME/bin/java -version
  165. echo which java
  166. which java
  167. java -version
  168. echo which javac
  169. which javac
  170. javac -version
  171. echo '<project default="test"><target name="test"><echo>Java ${ant.java.version}/${java.version}</echo><exec executable="javac"><arg value="-version"/></exec></target></project>' > build.javacheck.xml
  172. ant -f build.javacheck.xml -v
  173. POIJOBSHELL
  174. # ignore any error message
  175. exit 0'''
  176. def shellCmdsWin =
  177. '''@echo off
  178. :: show which files are currently modified in the working copy
  179. svn status
  180. :: print out information about which exact version of java we are using
  181. echo Java-Home: %JAVA_HOME%
  182. dir "%JAVA_HOME:\\\\=\\%"
  183. "%JAVA_HOME%/bin/java" -version
  184. POIJOBSHELL
  185. :: ignore any error message
  186. exit /b 0'''
  187. poijobs.each { poijob ->
  188. def jdkKey = poijob.jdk ?: defaultJdk
  189. def trigger = poijob.trigger ?: defaultTrigger
  190. def email = poijob.email ?: defaultEmail
  191. def slaves = poijob.slaves ?: defaultSlaves + (poijob.slaveAdd ?: '')
  192. def antRT = defaultAnt + (poijob.windows ? ' (Windows)' : '')
  193. job(poijob.name) {
  194. if (poijob.disabled) {
  195. disabled()
  196. }
  197. description( defaultDesc + (poijob.apicheck ? apicheckDesc : sonarDesc) )
  198. logRotator {
  199. numToKeep(5)
  200. artifactNumToKeep(1)
  201. }
  202. label(slaves)
  203. environmentVariables {
  204. env('LANG', 'en_US.UTF-8')
  205. if(jdkKey == '1.10') {
  206. // when using JDK 9/10 for running Ant, we need to provide more modules for the forbidden-api-checks task
  207. // on JDK 11 and newer there is no such module any more, so do not add it here
  208. env('ANT_OPTS', '--add-modules=java.xml.bind --add-opens=java.xml/com.sun.org.apache.xerces.internal.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED')
  209. }
  210. env('FORREST_HOME', poijob.windows ? 'f:\\jenkins\\tools\\forrest\\latest' : '/home/jenkins/tools/forrest/latest')
  211. }
  212. wrappers {
  213. timeout {
  214. absolute(180)
  215. abortBuild()
  216. writeDescription('Build was aborted due to timeout')
  217. }
  218. preBuildCleanup {
  219. includePattern('**/ooxml-lib/ooxml*.jar')
  220. }
  221. if(poijob.sonar) {
  222. configure { project ->
  223. project / buildWrappers << 'hudson.plugins.sonar.SonarBuildWrapper' {}
  224. }
  225. }
  226. }
  227. jdk(jdkMapping.get(jdkKey))
  228. scm {
  229. if (poijob.githubpr) {
  230. git {
  231. remote {
  232. github('apache/poi')
  233. refspec('+refs/pull/*:refs/remotes/origin/pr/*')
  234. }
  235. branch('${sha1}')
  236. }
  237. } else {
  238. svn(svnBase) { svnNode ->
  239. svnNode / browser(class: 'hudson.scm.browsers.ViewSVN') /
  240. url << 'http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN'
  241. }
  242. }
  243. }
  244. checkoutRetryCount(3)
  245. if (poijob.githubpr) {
  246. throttleConcurrentBuilds {
  247. maxPerNode(1)
  248. maxTotal(1)
  249. }
  250. parameters {
  251. /* plugin not available:
  252. gitParam('sha1') {
  253. description('Pull request')
  254. type('BRANCH')
  255. }*/
  256. stringParam('sha1', 'origin/pr/9/head', 'Provide a branch-spec, e.g. origin/pr/9/head')
  257. }
  258. triggers {
  259. githubPullRequest {
  260. admins(['centic9', 'poi-benchmark', 'tballison', 'gagravarr', 'onealj', 'pjfanning', 'Alain-Bearez'])
  261. userWhitelist(['centic9', 'poi-benchmark', 'tballison', 'gagravarr', 'onealj', 'pjfanning', 'Alain-Bearez'])
  262. orgWhitelist(['apache'])
  263. cron('H/5 * * * *')
  264. triggerPhrase('OK to test')
  265. }
  266. }
  267. } else {
  268. triggers {
  269. scm(trigger)
  270. }
  271. }
  272. def shellcmds = (poijob.windows ? shellCmdsWin : shellCmdsUnix).replace('POIJOBSHELL', poijob.shell ?: '')
  273. // Create steps and publishers depending on the type of Job that is selected
  274. if(poijob.maven) {
  275. steps {
  276. shellEx(delegate, shellcmds, poijob)
  277. maven {
  278. goals('clean')
  279. rootPOM('sonar/pom.xml')
  280. localRepository(LocalRepositoryLocation.LOCAL_TO_WORKSPACE)
  281. mavenInstallation('maven-3.2.1')
  282. }
  283. /* Currently not done, let's see if it is still necessary:
  284. # Maven-Download fails for strange reasons, try to workaround...
  285. mkdir -p sonar/ooxml-schema-security/target/schemas && wget -O sonar/ooxml-schema-security/target/schemas/xmldsig-core-schema.xsd http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/xmldsig-core-schema.xsd
  286. */
  287. maven {
  288. if(poijob.sonar) {
  289. goals('compile $SONAR_MAVEN_GOAL -Dsonar.host.url=$SONAR_HOST_URL')
  290. } else {
  291. goals('package')
  292. }
  293. rootPOM('sonar/pom.xml')
  294. mavenOpts('-Xmx2g')
  295. mavenOpts('-Xms256m')
  296. mavenOpts('-XX:-OmitStackTraceInFastThrow')
  297. localRepository(LocalRepositoryLocation.LOCAL_TO_WORKSPACE)
  298. mavenInstallation('maven-3.2.1')
  299. }
  300. }
  301. publishers {
  302. if (!poijob.skipcigame) {
  303. configure { project ->
  304. project / publishers << 'hudson.plugins.cigame.GamePublisher' {}
  305. }
  306. }
  307. if (!poijob.sonar) {
  308. archiveJunit('sonar/*/target/surefire-reports/TEST-*.xml') {
  309. testDataPublishers {
  310. publishTestStabilityData()
  311. }
  312. }
  313. }
  314. mailer(email, false, false)
  315. }
  316. } else if (poijob.javadoc) {
  317. steps {
  318. shellEx(delegate, shellcmds, poijob)
  319. ant {
  320. targets(['clean', 'javadocs'] + (poijob.properties ?: []))
  321. prop('coverage.enabled', true)
  322. // Properties did not work, so I had to use targets instead
  323. //properties(poijob.properties ?: '')
  324. antInstallation(antRT)
  325. }
  326. shellEx(delegate, 'zip -r build/javadocs.zip build/site/apidocs', poijob)
  327. }
  328. publishers {
  329. if (!poijob.skipcigame) {
  330. configure { project ->
  331. project / publishers << 'hudson.plugins.cigame.GamePublisher' {}
  332. }
  333. }
  334. mailer(email, false, false)
  335. }
  336. } else if (poijob.apicheck) {
  337. steps {
  338. shellEx(delegate, shellcmds, poijob)
  339. gradle {
  340. tasks('japicmp')
  341. useWrapper(false)
  342. }
  343. }
  344. publishers {
  345. archiveArtifacts('build/*/build/reports/japi.html')
  346. if (!poijob.skipcigame) {
  347. configure { project ->
  348. project / publishers << 'hudson.plugins.cigame.GamePublisher' {}
  349. }
  350. }
  351. mailer(email, false, false)
  352. }
  353. } else if(poijob.sonar) {
  354. steps {
  355. shellEx(delegate, shellcmds, poijob)
  356. gradle {
  357. switches('-PenableSonar')
  358. switches('-Dsonar.host.url=$SONAR_HOST_URL')
  359. tasks('sonarqube')
  360. useWrapper(false)
  361. }
  362. }
  363. publishers {
  364. if (!poijob.skipcigame) {
  365. configure { project ->
  366. project / publishers << 'hudson.plugins.cigame.GamePublisher' {}
  367. }
  368. }
  369. mailer(email, false, false)
  370. }
  371. } else {
  372. steps {
  373. shellEx(delegate, shellcmds, poijob)
  374. if(poijob.addShell) {
  375. shellEx(delegate, poijob.addShell, poijob)
  376. }
  377. // For Jobs that should still have the default set of publishers we can configure different steps here
  378. if(poijob.gradle) {
  379. gradle {
  380. tasks('check')
  381. useWrapper(false)
  382. }
  383. } else if (poijob.noScratchpad) {
  384. ant {
  385. targets(['clean', 'compile'] + (poijob.properties ?: []))
  386. prop('coverage.enabled', true)
  387. antInstallation(antRT)
  388. }
  389. ant {
  390. targets(['-Dscratchpad.ignore=true', 'jacocotask', 'test-all', 'testcoveragereport'] + (poijob.properties ?: []))
  391. prop('coverage.enabled', true)
  392. antInstallation(antRT)
  393. }
  394. } else {
  395. ant {
  396. targets(['clean', 'jenkins'] + (poijob.properties ?: []))
  397. prop('coverage.enabled', true)
  398. // Properties did not work, so I had to use targets instead
  399. //properties(poijob.properties ?: '')
  400. antInstallation(antRT)
  401. }
  402. ant {
  403. targets(['run'] + (poijob.properties ?: []))
  404. buildFile('src/integrationtest/build.xml')
  405. // Properties did not work, so I had to use targets instead
  406. //properties(poijob.properties ?: '')
  407. antInstallation(antRT)
  408. }
  409. }
  410. }
  411. publishers {
  412. findbugs('build/findbugs.xml', false) {
  413. healthLimits(3, 20)
  414. thresholdLimit('low')
  415. defaultEncoding('UTF-8')
  416. }
  417. // in archive, junit and jacoco publishers, matches beneath build/*/build/... are for Gradle-build results
  418. archiveArtifacts('build/dist/*.tar.gz,build/findbugs.html,build/coverage/**,build/integration-test-results/**,ooxml-lib/**,build/*/build/libs/*.jar')
  419. warnings(['Java Compiler (javac)', 'JavaDoc Tool'], null) {
  420. resolveRelativePaths()
  421. }
  422. 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,build/*/build/test-results/test/TEST-*.xml,build/*/build/test-results/TEST-*.xml') {
  423. testDataPublishers {
  424. publishTestStabilityData()
  425. }
  426. }
  427. jacocoCodeCoverage {
  428. classPattern('build/classes,build/excelant-classes,build/ooxml-classes,build/scratchpad-classes,build/*/build/classes')
  429. execPattern('build/*.exec,build/*/build/jacoco/*.exec')
  430. sourcePattern('src/java,src/excelant/java,src/ooxml/java,src/scratchpad/src')
  431. 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')
  432. }
  433. if (!poijob.skipcigame) {
  434. configure { project ->
  435. project / publishers << 'hudson.plugins.cigame.GamePublisher' {}
  436. }
  437. }
  438. mailer(email, false, false)
  439. }
  440. }
  441. }
  442. }
  443. xmlbeansjobs.each { xjob ->
  444. def jdkKey = xjob.jdk ?: defaultJdk
  445. def trigger = xjob.trigger ?: defaultTrigger
  446. def email = xjob.email ?: defaultEmail
  447. def slaves = xjob.slaves ?: defaultSlaves + (xjob.slaveAdd ?: '')
  448. def antRT = defaultAnt + (xjob.windows ? ' (Windows)' : '')
  449. job(xjob.name) {
  450. if (xjob.disabled) {
  451. disabled()
  452. }
  453. description( defaultDesc + (xjob.apicheck ? apicheckDesc : sonarDesc) )
  454. logRotator {
  455. numToKeep(5)
  456. artifactNumToKeep(1)
  457. }
  458. label(slaves)
  459. environmentVariables {
  460. env('LANG', 'en_US.UTF-8')
  461. if(jdkKey == '1.10') {
  462. // when using JDK 9/10 for running Ant, we need to provide more modules for the forbidden-api-checks task
  463. // on JDK 11 and newer there is no such module any more, so do not add it here
  464. env('ANT_OPTS', '--add-modules=java.xml.bind --add-opens=java.xml/com.sun.org.apache.xerces.internal.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED')
  465. }
  466. env('FORREST_HOME', xjob.windows ? 'f:\\jenkins\\tools\\forrest\\latest' : '/home/jenkins/tools/forrest/latest')
  467. }
  468. wrappers {
  469. timeout {
  470. absolute(180)
  471. abortBuild()
  472. writeDescription('Build was aborted due to timeout')
  473. }
  474. }
  475. jdk(jdkMapping.get(jdkKey))
  476. scm {
  477. svn(xmlbeansSvnBase) { svnNode ->
  478. svnNode / browser(class: 'hudson.scm.browsers.ViewSVN') /
  479. url << 'http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN'
  480. }
  481. }
  482. checkoutRetryCount(3)
  483. triggers {
  484. scm(trigger)
  485. }
  486. def shellcmds = (xjob.windows ? shellCmdsWin : shellCmdsUnix).replace('POIJOBSHELL', xjob.shell ?: '')
  487. // Create steps and publishers depending on the type of Job that is selected
  488. steps {
  489. shellEx(delegate, shellcmds, xjob)
  490. if(xjob.addShell) {
  491. shellEx(delegate, xjob.addShell, xjob)
  492. }
  493. ant {
  494. targets(['clean'])
  495. antInstallation(antRT)
  496. }
  497. ant {
  498. targets(['checkintest'])
  499. antInstallation(antRT)
  500. }
  501. ant {
  502. targets(['dist'])
  503. antInstallation(antRT)
  504. }
  505. }
  506. publishers {
  507. archiveArtifacts('build/private/**')
  508. //archiveJunit('build/test/reports/*.xml') {
  509. // testDataPublishers {
  510. // publishTestStabilityData()
  511. // }
  512. //}
  513. if (!xjob.skipcigame) {
  514. configure { project ->
  515. project / publishers << 'hudson.plugins.cigame.GamePublisher' {}
  516. }
  517. }
  518. mailer(email, false, false)
  519. }
  520. }
  521. }
  522. /*
  523. Add a special job which spans a two-dimensional matrix of all JDKs that we want to use and
  524. all slaves that we would like to use and test if the java and ant binaries are available
  525. on that machine correctly.
  526. */
  527. matrixJob('POI-DSL-Test-Environment') {
  528. description(
  529. '''Check installed version of Java/Ant on all build-nodes
  530. This job is used to verify which machines actually have the required programs installed.
  531. Unfortunately we often see builds break because of changes/new machines...''')
  532. /*throttleConcurrentBuilds {
  533. maxPerNode(1)
  534. maxTotal(1)
  535. }*/
  536. logRotator {
  537. numToKeep(1)
  538. artifactNumToKeep(1)
  539. }
  540. axes {
  541. jdk(
  542. 'JDK 1.8 (latest)',
  543. 'OpenJDK 8 (on Ubuntu only) ', // blank is required here until the name in the Jenkins instance is fixed!
  544. 'IBM 1.8 64-bit (on Ubuntu only)',
  545. 'JDK 10 (latest)',
  546. 'JDK 10 b46 (Windows Only)',
  547. 'OpenJDK 10.0.2 (on Ubuntu only)',
  548. 'JDK 11 (latest)',
  549. 'JDK 11 b23 (early access build) (Windows Only)',
  550. 'JDK 12 (latest)',
  551. 'OpenJDK 12 b18 (early access build)'
  552. )
  553. elasticAxis {
  554. name('Nodes')
  555. labelString('!cloud-slave&&!H15&&!H17&&!H18&&!H24&&!ubuntu-4&&!H21&&!H35&&!websites1&&!couchdb&&!plc4x&&!ppc64le')
  556. ignoreOffline(true)
  557. }
  558. }
  559. steps {
  560. conditionalSteps {
  561. condition {
  562. fileExists('/usr', BaseDir.WORKSPACE)
  563. runner('DontRun')
  564. steps {
  565. shell(
  566. '''which javac
  567. javac -version
  568. echo '<?xml version="1.0"?><project name="POI Build" default="test"><target name="test"><echo>Using Ant: ${ant.version} from ${ant.home}</echo></target></project>' > build.xml
  569. ''')
  570. ant {
  571. antInstallation(defaultAnt)
  572. }
  573. }
  574. }
  575. }
  576. conditionalSteps {
  577. condition {
  578. fileExists('c:\\windows', BaseDir.WORKSPACE)
  579. runner('DontRun')
  580. steps {
  581. batchFile {
  582. command(
  583. '''@echo off
  584. echo .
  585. where javac.exe
  586. echo .
  587. javac -version
  588. echo .
  589. echo ^<?xml version=^"1.0^"?^>^<project name=^"POI Build^" default=^"test^"^>^<target name=^"test^"^>^<echo^>Using Ant: ${ant.version} from ${ant.home}^</echo^>^</target^>^</project^> > build.xml
  590. ''')
  591. }
  592. ant {
  593. antInstallation(defaultAnt + ' (Windows)')
  594. }
  595. }
  596. }
  597. }
  598. }
  599. }
  600. /* I tried to put the view into a sub-folder/sub-view, but failed, there are multiple related
  601. plugins so this is all a bit confusing :(, see also https://issues.apache.org/jira/browse/INFRA-14002
  602. dashboardView("P/POI-new") {
  603. columns {
  604. status()
  605. weather()
  606. configureProject()
  607. buildButton()
  608. cronTrigger()
  609. lastBuildConsole()
  610. name()
  611. lastSuccess()
  612. lastFailure()
  613. lastDuration()
  614. //lastSuccessDescription()
  615. jacoco()
  616. }
  617. description("<table>\n" +
  618. " <tr>\n" +
  619. " <td><img src=\"https://poi.apache.org/images/project-header.png\" /></td>\n" +
  620. " <td> \n" +
  621. " <p>Apache POI - the Java API for Microsoft Documents</p>\n" +
  622. " <p><b>Most of the POI Jobs are automatically generated by Jenkins Job DSL\n" +
  623. " at <a href=\"https://svn.apache.org/repos/asf/poi/trunk/jenkins\">https://svn.apache.org/repos/asf/poi/trunk/jenkins</a>,<br/>\n" +
  624. " see <a href=\"https://github.com/jenkinsci/job-dsl-plugin/wiki\">https://github.com/jenkinsci/job-dsl-plugin/wiki</a>\n" +
  625. " for more details about the DSL.</b>\n" +
  626. " </p>\n" +
  627. " <p>\n" +
  628. " <b><a href=\"job/POI-DSL-1.8/lastSuccessfulBuild/findbugsResult/\" target=\"_blank\">Findbugs report of latest build</a></b> -\n" +
  629. " <b><a href=\"https://builds.apache.org/analysis/dashboard?id=org.apache.poi%3Apoi-parent&did=1\" target=\"_blank\">Sonar reports</a></b> -\n" +
  630. " <b><a href=\"job/POI-DSL-1.8/lastSuccessfulBuild/artifact/build/coverage/index.html\" target=\"_blank\">Coverage of latest build</a></b>\n" +
  631. " </p>\n" +
  632. " </td>\n" +
  633. " </tr>\n" +
  634. "</table>")
  635. filterBuildQueue(false)
  636. filterExecutors(false)
  637. // Job selection
  638. jobs {*/
  639. //regex(/.*POI.*/)
  640. /*}
  641. // Layout
  642. topPortlets {
  643. jenkinsJobsList {
  644. displayName('POI jobs')
  645. }
  646. }
  647. leftPortlets {
  648. testStatisticsChart()
  649. }
  650. rightPortlets {
  651. testTrendChart()
  652. }
  653. bottomPortlets {
  654. testStatisticsGrid()
  655. buildStatistics()
  656. }
  657. }*/