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 28KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671
  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: ['-Djava9addmods=-Dthis.is.a.dummy=true',
  42. '-Djavadoc9addmods=-Dthis.is.a.dummy=true',
  43. '-Djava9addmodsvalue=-Dsun.reflect.debugModuleAccessChecks=true',
  44. '-Djava9addopens1=--add-opens=java.xml/com.sun.org.apache.xerces.internal.util=ALL-UNNAMED',
  45. '-Djava9addopens2=--add-opens=java.base/java.io=ALL-UNNAMED',
  46. '-Djava9addopens3=--add-opens=java.base/java.nio=ALL-UNNAMED',
  47. '-Djava9addopens4=--add-opens=java.base/java.lang=ALL-UNNAMED',
  48. '-Djava9addopens5=--add-opens=java.base/jdk.internal.ref=ALL-UNNAMED',
  49. '-Djava9addopens6=-Dthis.is.a.dummy=true',
  50. '-Djava.locale.providers=JRE,CLDR'],
  51. skipcigame: true
  52. ],
  53. [ name: 'POI-DSL-1.12', jdk: '1.12', trigger: '''
  54. # do not run this via a schedule for now
  55. ''',
  56. // Nodes beam* do not yet have JDK 12 installed
  57. slaveAdd: '&&!beam1&&!beam2&&!beam3&&!beam4&&!beam6&&!beam7&&!beam8&&!beam9&&!beam10&&!beam11&&!beam12&&!beam13&&!beam14&&!beam15&&!beam16',
  58. properties: ['-Djava9addmods=-Dthis.is.a.dummy=true',
  59. '-Djavadoc9addmods=-Dthis.is.a.dummy=true',
  60. '-Djava9addmodsvalue=-Dsun.reflect.debugModuleAccessChecks=true',
  61. '-Djava9addopens1=--add-opens=java.xml/com.sun.org.apache.xerces.internal.util=ALL-UNNAMED',
  62. '-Djava9addopens2=--add-opens=java.base/java.io=ALL-UNNAMED',
  63. '-Djava9addopens3=--add-opens=java.base/java.nio=ALL-UNNAMED',
  64. '-Djava9addopens4=--add-opens=java.base/java.lang=ALL-UNNAMED',
  65. '-Djava9addopens5=--add-opens=java.base/jdk.internal.ref=ALL-UNNAMED',
  66. '-Djava9addopens6=-Dthis.is.a.dummy=true',
  67. '-Djava.locale.providers=JRE,CLDR'],
  68. skipcigame: true
  69. ],
  70. [ name: 'POI-DSL-IBM-JDK', jdk: 'IBMJDK', trigger: triggerSundays,
  71. // some OOXML tests fail with strange XML parsing errors and missing JCE unlimited strength requirements
  72. disabled: true, skipcigame: true
  73. ],
  74. [ name: 'POI-DSL-old-Xerces', trigger: triggerSundays,
  75. shell: "test -f ${xercesLib} || wget -O ${xercesLib} ${xercesUrl}\n",
  76. // the property triggers using Xerces as XML Parser and previously showed some exception that can occur
  77. properties: ["-Dadditionaljar=${xercesLib}"]
  78. ],
  79. [ name: 'POI-DSL-Maven', trigger: 'H */4 * * *', maven: true
  80. ],
  81. [ name: 'POI-DSL-regenerate-javadoc', trigger: triggerSundays, javadoc: true
  82. ],
  83. // disabled for 4.0.0 because we break compatibility on-purpose in a few places, e.g. for Java 9 compatibility
  84. [ name: 'POI-DSL-API-Check', trigger: '@daily', apicheck: true, disabled: true
  85. ],
  86. [ name: 'POI-DSL-Gradle', trigger: triggerSundays, email: 'centic@apache.org', gradle: true,
  87. // Gradle will not run any tests if the code is up-to-date, therefore manually mark the files as updated
  88. addShell: 'touch --no-create build/*/build/test-results/TEST-*.xml build/*/build/test-results/test/TEST-*.xml'
  89. ],
  90. [ name: 'POI-DSL-no-scratchpad', trigger: triggerSundays, noScratchpad: true
  91. ],
  92. [ name: 'POI-DSL-SonarQube', trigger: 'H 9 * * *', maven: true, sonar: true, skipcigame: true
  93. ],
  94. [ name: 'POI-DSL-SonarQube-Gradle', trigger: 'H 9 * * *', gradle: true, sonar: true, skipcigame: true,
  95. disabled: true // this one does run, but does not actually send data to Sonarqube for some reason, we need to investigate some more
  96. ],
  97. [ name: 'POI-DSL-Windows-1.8', trigger: 'H */12 * * *', windows: true, slaves: 'Windows'
  98. ],
  99. ]
  100. def xmlbeansjobs = [
  101. [ name: 'POI-XMLBeans-DSL-1.6', jdk: '1.6', trigger: 'H */12 * * *', skipcigame: true
  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. svn(svnBase) { svnNode ->
  230. svnNode / browser(class: 'hudson.scm.browsers.ViewSVN') /
  231. url << 'http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN'
  232. }
  233. }
  234. checkoutRetryCount(3)
  235. triggers {
  236. scm(trigger)
  237. }
  238. def shellcmds = (poijob.windows ? shellCmdsWin : shellCmdsUnix).replace('POIJOBSHELL', poijob.shell ?: '')
  239. // Create steps and publishers depending on the type of Job that is selected
  240. if(poijob.maven) {
  241. steps {
  242. shellEx(delegate, shellcmds, poijob)
  243. maven {
  244. goals('clean')
  245. rootPOM('sonar/pom.xml')
  246. localRepository(LocalRepositoryLocation.LOCAL_TO_WORKSPACE)
  247. mavenInstallation('maven-3.2.1')
  248. }
  249. /* Currently not done, let's see if it is still necessary:
  250. # Maven-Download fails for strange reasons, try to workaround...
  251. 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
  252. */
  253. maven {
  254. if(poijob.sonar) {
  255. goals('compile $SONAR_MAVEN_GOAL -Dsonar.host.url=$SONAR_HOST_URL')
  256. } else {
  257. goals('package')
  258. }
  259. rootPOM('sonar/pom.xml')
  260. mavenOpts('-Xmx2g')
  261. mavenOpts('-Xms256m')
  262. mavenOpts('-XX:-OmitStackTraceInFastThrow')
  263. localRepository(LocalRepositoryLocation.LOCAL_TO_WORKSPACE)
  264. mavenInstallation('maven-3.2.1')
  265. }
  266. }
  267. publishers {
  268. if (!poijob.skipcigame) {
  269. configure { project ->
  270. project / publishers << 'hudson.plugins.cigame.GamePublisher' {}
  271. }
  272. }
  273. if (!poijob.sonar) {
  274. archiveJunit('sonar/*/target/surefire-reports/TEST-*.xml') {
  275. testDataPublishers {
  276. publishTestStabilityData()
  277. }
  278. }
  279. }
  280. mailer(email, false, false)
  281. }
  282. } else if (poijob.javadoc) {
  283. steps {
  284. shellEx(delegate, shellcmds, poijob)
  285. ant {
  286. targets(['clean', 'javadocs'] + (poijob.properties ?: []))
  287. prop('coverage.enabled', true)
  288. // Properties did not work, so I had to use targets instead
  289. //properties(poijob.properties ?: '')
  290. antInstallation(antRT)
  291. }
  292. shellEx(delegate, 'zip -r build/javadocs.zip build/site/apidocs', poijob)
  293. }
  294. publishers {
  295. if (!poijob.skipcigame) {
  296. configure { project ->
  297. project / publishers << 'hudson.plugins.cigame.GamePublisher' {}
  298. }
  299. }
  300. mailer(email, false, false)
  301. }
  302. } else if (poijob.apicheck) {
  303. steps {
  304. shellEx(delegate, shellcmds, poijob)
  305. gradle {
  306. tasks('japicmp')
  307. useWrapper(false)
  308. }
  309. }
  310. publishers {
  311. archiveArtifacts('build/*/build/reports/japi.html')
  312. if (!poijob.skipcigame) {
  313. configure { project ->
  314. project / publishers << 'hudson.plugins.cigame.GamePublisher' {}
  315. }
  316. }
  317. mailer(email, false, false)
  318. }
  319. } else if(poijob.sonar) {
  320. steps {
  321. shellEx(delegate, shellcmds, poijob)
  322. gradle {
  323. switches('-PenableSonar')
  324. switches('-Dsonar.host.url=$SONAR_HOST_URL')
  325. tasks('sonarqube')
  326. useWrapper(false)
  327. }
  328. }
  329. publishers {
  330. if (!poijob.skipcigame) {
  331. configure { project ->
  332. project / publishers << 'hudson.plugins.cigame.GamePublisher' {}
  333. }
  334. }
  335. mailer(email, false, false)
  336. }
  337. } else {
  338. steps {
  339. shellEx(delegate, shellcmds, poijob)
  340. if(poijob.addShell) {
  341. shellEx(delegate, poijob.addShell, poijob)
  342. }
  343. // For Jobs that should still have the default set of publishers we can configure different steps here
  344. if(poijob.gradle) {
  345. gradle {
  346. tasks('check')
  347. useWrapper(false)
  348. }
  349. } else if (poijob.noScratchpad) {
  350. ant {
  351. targets(['clean', 'compile'] + (poijob.properties ?: []))
  352. prop('coverage.enabled', true)
  353. antInstallation(antRT)
  354. }
  355. ant {
  356. targets(['-Dscratchpad.ignore=true', 'jacocotask', 'test-all', 'testcoveragereport'] + (poijob.properties ?: []))
  357. prop('coverage.enabled', true)
  358. antInstallation(antRT)
  359. }
  360. } else {
  361. ant {
  362. targets(['clean', 'jenkins'] + (poijob.properties ?: []))
  363. prop('coverage.enabled', true)
  364. // Properties did not work, so I had to use targets instead
  365. //properties(poijob.properties ?: '')
  366. antInstallation(antRT)
  367. }
  368. ant {
  369. targets(['run'] + (poijob.properties ?: []))
  370. buildFile('src/integrationtest/build.xml')
  371. // Properties did not work, so I had to use targets instead
  372. //properties(poijob.properties ?: '')
  373. antInstallation(antRT)
  374. }
  375. }
  376. }
  377. publishers {
  378. findbugs('build/findbugs.xml', false) {
  379. healthLimits(3, 20)
  380. thresholdLimit('low')
  381. defaultEncoding('UTF-8')
  382. }
  383. // in archive, junit and jacoco publishers, matches beneath build/*/build/... are for Gradle-build results
  384. archiveArtifacts('build/dist/*.tar.gz,build/findbugs.html,build/coverage/**,build/integration-test-results/**,ooxml-lib/**,build/*/build/libs/*.jar')
  385. warnings(['Java Compiler (javac)', 'JavaDoc Tool'], null) {
  386. resolveRelativePaths()
  387. }
  388. 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') {
  389. testDataPublishers {
  390. publishTestStabilityData()
  391. }
  392. }
  393. jacocoCodeCoverage {
  394. classPattern('build/classes,build/excelant-classes,build/ooxml-classes,build/scratchpad-classes,build/*/build/classes')
  395. execPattern('build/*.exec,build/*/build/jacoco/*.exec')
  396. sourcePattern('src/java,src/excelant/java,src/ooxml/java,src/scratchpad/src')
  397. 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')
  398. }
  399. if (!poijob.skipcigame) {
  400. configure { project ->
  401. project / publishers << 'hudson.plugins.cigame.GamePublisher' {}
  402. }
  403. }
  404. mailer(email, false, false)
  405. }
  406. }
  407. }
  408. }
  409. xmlbeansjobs.each { xjob ->
  410. def jdkKey = xjob.jdk ?: defaultJdk
  411. def trigger = xjob.trigger ?: defaultTrigger
  412. def email = xjob.email ?: defaultEmail
  413. def slaves = xjob.slaves ?: defaultSlaves + (xjob.slaveAdd ?: '')
  414. def antRT = defaultAnt + (xjob.windows ? ' (Windows)' : '')
  415. job(xjob.name) {
  416. if (xjob.disabled) {
  417. disabled()
  418. }
  419. description( defaultDesc + (xjob.apicheck ? apicheckDesc : sonarDesc) )
  420. logRotator {
  421. numToKeep(5)
  422. artifactNumToKeep(1)
  423. }
  424. label(slaves)
  425. environmentVariables {
  426. env('LANG', 'en_US.UTF-8')
  427. if(jdkKey == '1.10') {
  428. // when using JDK 9/10 for running Ant, we need to provide more modules for the forbidden-api-checks task
  429. // on JDK 11 and newer there is no such module any more, so do not add it here
  430. 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')
  431. }
  432. env('FORREST_HOME', xjob.windows ? 'f:\\jenkins\\tools\\forrest\\latest' : '/home/jenkins/tools/forrest/latest')
  433. }
  434. wrappers {
  435. timeout {
  436. absolute(180)
  437. abortBuild()
  438. writeDescription('Build was aborted due to timeout')
  439. }
  440. }
  441. jdk(jdkMapping.get(jdkKey))
  442. scm {
  443. svn(xmlbeansSvnBase) { svnNode ->
  444. svnNode / browser(class: 'hudson.scm.browsers.ViewSVN') /
  445. url << 'http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN'
  446. }
  447. }
  448. checkoutRetryCount(3)
  449. triggers {
  450. scm(trigger)
  451. }
  452. def shellcmds = (xjob.windows ? shellCmdsWin : shellCmdsUnix).replace('POIJOBSHELL', xjob.shell ?: '')
  453. // Create steps and publishers depending on the type of Job that is selected
  454. steps {
  455. shellEx(delegate, shellcmds, xjob)
  456. if(xjob.addShell) {
  457. shellEx(delegate, xjob.addShell, xjob)
  458. }
  459. ant {
  460. targets(['clean'])
  461. antInstallation(antRT)
  462. }
  463. ant {
  464. targets(['checkintest'])
  465. antInstallation(antRT)
  466. }
  467. ant {
  468. targets(['dist'])
  469. antInstallation(antRT)
  470. }
  471. }
  472. publishers {
  473. archiveArtifacts('build/private/**')
  474. //archiveJunit('build/test/reports/*.xml') {
  475. // testDataPublishers {
  476. // publishTestStabilityData()
  477. // }
  478. //}
  479. if (!xjob.skipcigame) {
  480. configure { project ->
  481. project / publishers << 'hudson.plugins.cigame.GamePublisher' {}
  482. }
  483. }
  484. mailer(email, false, false)
  485. }
  486. }
  487. }
  488. /*
  489. Add a special job which spans a two-dimensional matrix of all JDKs that we want to use and
  490. all slaves that we would like to use and test if the java and ant binaries are available
  491. on that machine correctly.
  492. */
  493. matrixJob('POI-DSL-Test-Environment') {
  494. description(
  495. '''Check installed version of Java/Ant on all build-nodes
  496. This job is used to verify which machines actually have the required programs installed.
  497. Unfortunately we often see builds break because of changes/new machines...''')
  498. /*throttleConcurrentBuilds {
  499. maxPerNode(1)
  500. maxTotal(1)
  501. }*/
  502. logRotator {
  503. numToKeep(1)
  504. artifactNumToKeep(1)
  505. }
  506. axes {
  507. jdk(
  508. 'JDK 1.8 (latest)',
  509. 'OpenJDK 8 (on Ubuntu only) ', // blank is required here until the name in the Jenkins instance is fixed!
  510. 'IBM 1.8 64-bit (on Ubuntu only)',
  511. 'JDK 10 (latest)',
  512. 'JDK 10 b46 (Windows Only)',
  513. 'OpenJDK 10.0.2 (on Ubuntu only)',
  514. 'JDK 11 (latest)',
  515. 'JDK 11 b23 (early access build) (Windows Only)',
  516. 'JDK 12 (latest)',
  517. 'OpenJDK 12 b18 (early access build)'
  518. )
  519. elasticAxis {
  520. name('Nodes')
  521. labelString('!cloud-slave&&!H15&&!H17&&!H18&&!H24&&!ubuntu-4&&!H21&&!H35&&!websites1&&!couchdb&&!plc4x&&!ppc64le')
  522. ignoreOffline(true)
  523. }
  524. }
  525. steps {
  526. conditionalSteps {
  527. condition {
  528. fileExists('/usr', BaseDir.WORKSPACE)
  529. runner('DontRun')
  530. steps {
  531. shell(
  532. '''which javac
  533. javac -version
  534. 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
  535. ''')
  536. ant {
  537. antInstallation(defaultAnt)
  538. }
  539. }
  540. }
  541. }
  542. conditionalSteps {
  543. condition {
  544. fileExists('c:\\windows', BaseDir.WORKSPACE)
  545. runner('DontRun')
  546. steps {
  547. batchFile {
  548. command(
  549. '''@echo off
  550. echo .
  551. where javac.exe
  552. echo .
  553. javac -version
  554. echo .
  555. 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
  556. ''')
  557. }
  558. ant {
  559. antInstallation(defaultAnt + ' (Windows)')
  560. }
  561. }
  562. }
  563. }
  564. }
  565. }
  566. /* I tried to put the view into a sub-folder/sub-view, but failed, there are multiple related
  567. plugins so this is all a bit confusing :(, see also https://issues.apache.org/jira/browse/INFRA-14002
  568. dashboardView("P/POI-new") {
  569. columns {
  570. status()
  571. weather()
  572. configureProject()
  573. buildButton()
  574. cronTrigger()
  575. lastBuildConsole()
  576. name()
  577. lastSuccess()
  578. lastFailure()
  579. lastDuration()
  580. //lastSuccessDescription()
  581. jacoco()
  582. }
  583. description("<table>\n" +
  584. " <tr>\n" +
  585. " <td><img src=\"https://poi.apache.org/images/project-header.png\" /></td>\n" +
  586. " <td> \n" +
  587. " <p>Apache POI - the Java API for Microsoft Documents</p>\n" +
  588. " <p><b>Most of the POI Jobs are automatically generated by Jenkins Job DSL\n" +
  589. " at <a href=\"https://svn.apache.org/repos/asf/poi/trunk/jenkins\">https://svn.apache.org/repos/asf/poi/trunk/jenkins</a>,<br/>\n" +
  590. " see <a href=\"https://github.com/jenkinsci/job-dsl-plugin/wiki\">https://github.com/jenkinsci/job-dsl-plugin/wiki</a>\n" +
  591. " for more details about the DSL.</b>\n" +
  592. " </p>\n" +
  593. " <p>\n" +
  594. " <b><a href=\"job/POI-DSL-1.8/lastSuccessfulBuild/findbugsResult/\" target=\"_blank\">Findbugs report of latest build</a></b> -\n" +
  595. " <b><a href=\"https://builds.apache.org/analysis/dashboard?id=org.apache.poi%3Apoi-parent&did=1\" target=\"_blank\">Sonar reports</a></b> -\n" +
  596. " <b><a href=\"job/POI-DSL-1.8/lastSuccessfulBuild/artifact/build/coverage/index.html\" target=\"_blank\">Coverage of latest build</a></b>\n" +
  597. " </p>\n" +
  598. " </td>\n" +
  599. " </tr>\n" +
  600. "</table>")
  601. filterBuildQueue(false)
  602. filterExecutors(false)
  603. // Job selection
  604. jobs {*/
  605. //regex(/.*POI.*/)
  606. /*}
  607. // Layout
  608. topPortlets {
  609. jenkinsJobsList {
  610. displayName('POI jobs')
  611. }
  612. }
  613. leftPortlets {
  614. testStatisticsChart()
  615. }
  616. rightPortlets {
  617. testTrendChart()
  618. }
  619. bottomPortlets {
  620. testStatisticsGrid()
  621. buildStatistics()
  622. }
  623. }*/