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

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