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

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