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

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