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

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