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

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