2016-12-02 06:07:22 -05:00
// This script is used as input to the Jenkins Job DSL plugin to create all the build-jobs that
2017-05-04 05:25:40 -04:00
// Apache POI uses on the public Jenkins instance at https://builds.apache.org/view/P/view/POI/
2016-12-02 06:07:22 -05:00
//
// See https://github.com/jenkinsci/job-dsl-plugin/wiki for information about the DSL, you can
// use http://job-dsl.herokuapp.com/ to validate the code before checkin
2020-01-07 16:15:33 -05:00
//
2016-12-01 14:09:26 -05:00
2016-12-01 15:49:29 -05:00
def triggerSundays = '' '
# only run this once per week on Sundays
H H * * 0
'' '
2016-12-01 14:09:31 -05:00
2017-07-31 18:56:08 -04:00
def xercesUrl = 'http://repo1.maven.org/maven2/xerces/xercesImpl/2.6.1/xercesImpl-2.6.1.jar'
2018-09-07 16:47:08 -04:00
def xercesLib = './xercesImpl-2.6.1.jar'
2017-07-31 18:56:08 -04:00
2016-12-01 14:09:26 -05:00
def poijobs = [
2017-09-16 09:06:59 -04:00
[ name: 'POI-DSL-1.8' , trigger: 'H */12 * * *'
2017-09-16 05:08:45 -04:00
] ,
2019-01-24 15:35:18 -05:00
[ name: 'POI-DSL-1.10' , jdk: '1.10' , trigger: triggerSundays , skipcigame: true
2018-08-19 01:58:27 -04:00
] ,
2019-05-05 05:49:35 -04:00
[ name: 'POI-DSL-1.11' , jdk: '1.11' , trigger: triggerSundays , skipcigame: true
2018-08-26 07:41:25 -04:00
] ,
2019-01-24 15:35:18 -05:00
[ name: 'POI-DSL-1.12' , jdk: '1.12' , trigger: triggerSundays , skipcigame: true ,
// H43 has outdated JDK12 installed
2020-01-10 16:04:14 -05:00
slaveAdd: '&&!H43' ,
// let's save some CPU cycles here, 12 is not a LTS and JDK 13 is GA now
disabled: true
2018-03-04 08:33:12 -05:00
] ,
2019-05-05 05:49:35 -04:00
[ name: 'POI-DSL-1.13' , jdk: '1.13' , trigger: triggerSundays , skipcigame: true
2019-01-22 05:07:02 -05:00
] ,
2020-01-10 16:04:14 -05:00
[ name: 'POI-DSL-1.14' , jdk: '1.14' , trigger: triggerSundays , skipcigame: true
] ,
2018-12-16 10:48:55 -05:00
[ name: 'POI-DSL-IBM-JDK' , jdk: 'IBMJDK' , trigger: triggerSundays , skipcigame: true
2017-09-16 05:08:45 -04:00
] ,
[ name: 'POI-DSL-old-Xerces' , trigger: triggerSundays ,
2018-09-07 16:47:08 -04:00
shell: "test -f ${xercesLib} || wget -O ${xercesLib} ${xercesUrl}\n" ,
2017-09-16 05:08:45 -04:00
// the property triggers using Xerces as XML Parser and previously showed some exception that can occur
2017-09-22 16:06:31 -04:00
properties: [ "-Dadditionaljar=${xercesLib}" ]
2017-09-16 05:08:45 -04:00
] ,
[ name: 'POI-DSL-Maven' , trigger: 'H */4 * * *' , maven: true
] ,
[ name: 'POI-DSL-regenerate-javadoc' , trigger: triggerSundays , javadoc: true
] ,
2019-03-10 04:18:46 -04:00
[ name: 'POI-DSL-API-Check' , trigger: '@daily' , apicheck: true
2017-09-16 05:08:45 -04:00
] ,
2017-09-16 09:06:59 -04:00
[ name: 'POI-DSL-Gradle' , trigger: triggerSundays , email: 'centic@apache.org' , gradle: true ,
2017-09-16 05:08:45 -04:00
// Gradle will not run any tests if the code is up-to-date, therefore manually mark the files as updated
addShell: 'touch --no-create build/*/build/test-results/TEST-*.xml build/*/build/test-results/test/TEST-*.xml'
] ,
[ name: 'POI-DSL-no-scratchpad' , trigger: triggerSundays , noScratchpad: true
] ,
2017-09-22 17:30:40 -04:00
[ name: 'POI-DSL-SonarQube' , trigger: 'H 9 * * *' , maven: true , sonar: true , skipcigame: true
2017-09-16 05:08:45 -04:00
] ,
2017-09-22 17:30:40 -04:00
[ name: 'POI-DSL-SonarQube-Gradle' , trigger: 'H 9 * * *' , gradle: true , sonar: true , skipcigame: true ,
disabled: true // this one does run, but does not actually send data to Sonarqube for some reason, we need to investigate some more
2017-09-16 05:08:45 -04:00
] ,
2017-09-16 09:06:59 -04:00
[ name: 'POI-DSL-Windows-1.8' , trigger: 'H */12 * * *' , windows: true , slaves: 'Windows'
2017-09-16 05:08:45 -04:00
] ,
2020-01-10 16:04:14 -05:00
[ name: 'POI-DSL-Windows-1.12' , jdk: '1.12' , trigger: triggerSundays , windows: true , slaves: 'Windows' , skipcigame: true ,
// let's save some CPU cycles here, 12 is not a LTS and JDK 13 is GA now
disabled: true
] ,
[ name: 'POI-DSL-Windows-1.14' , jdk: '1.14' , trigger: triggerSundays , windows: true , slaves: 'Windows' , skipcigame: true
2019-01-22 05:07:02 -05:00
] ,
2018-12-28 16:43:49 -05:00
[ name: 'POI-DSL-Github-PullRequests' , trigger: '' , githubpr: true , skipcigame: true ,
// ensure the file which is needed from the separate documentation module does exist
// as we are checking out from git, we do not have the reference checked out here
2019-05-12 19:34:29 -04:00
addShell: 'mkdir -p src/documentation\ntouch src/documentation/RELEASE-NOTES.txt'
2018-12-28 06:17:57 -05:00
] ,
2016-12-01 14:09:26 -05:00
]
2018-10-02 04:15:41 -04:00
def xmlbeansjobs = [
2018-12-28 06:17:57 -05:00
[ name: 'POI-XMLBeans-DSL-1.6' , jdk: '1.6' , trigger: 'H */12 * * *' , skipcigame: true ,
2019-06-09 06:04:42 -04:00
disabled: true // XMLBeans does not support Java 6 any more
2018-12-28 06:17:57 -05:00
] ,
2019-06-09 06:04:42 -04:00
[ name: 'POI-XMLBeans-DSL-1.8' , jdk: '1.8' , trigger: 'H */12 * * *' , skipcigame: true ,
2018-12-28 06:17:57 -05:00
] ,
[ name: 'POI-XMLBeans-DSL-1.11' , jdk: '1.11' , trigger: triggerSundays , skipcigame: true ,
2019-03-03 09:09:58 -05:00
] ,
[ name: 'POI-XMLBeans-DSL-1.12' , jdk: '1.12' , trigger: triggerSundays , skipcigame: true ,
2020-01-10 16:04:14 -05:00
// let's save some CPU cycles here, 12 is not a LTS and JDK 13 is GA now
disabled: true
] ,
[ name: 'POI-XMLBeans-DSL-1.14' , jdk: '1.14' , trigger: triggerSundays , skipcigame: true ,
2018-10-02 04:15:41 -04:00
]
]
2016-12-08 04:36:48 -05:00
def svnBase = 'https://svn.apache.org/repos/asf/poi/trunk'
2018-10-02 04:15:41 -04:00
def xmlbeansSvnBase = 'https://svn.apache.org/repos/asf/xmlbeans/trunk'
2017-09-16 09:06:59 -04:00
def defaultJdk = '1.8'
2016-12-31 04:43:13 -05:00
def defaultTrigger = 'H/15 * * * *' // check SCM every 60/15 = 4 minutes
2016-12-01 14:09:31 -05:00
def defaultEmail = 'dev@poi.apache.org'
2019-04-22 14:48:35 -04:00
def defaultAnt = 'Ant 1.9 (Latest)'
def defaultAntWindows = 'Ant 1.9 (Latest Windows)'
2019-10-26 14:17:38 -04:00
def defaultMaven = 'Maven 3 (latest)'
2017-08-13 07:42:35 -04:00
// currently a lot of H?? slaves don't have Ant installed ... H21 seems to have a SVN problem
2018-11-16 13:49:26 -05:00
// H35 fails with ImageIO create cache file errors, although the java.io.tmpdir is writable
2019-05-12 19:34:29 -04:00
def defaultSlaves = '(ubuntu)&&!beam&&!cloud-slave&&!H15&&!H17&&!H18&&!H24&&!ubuntu-4&&!H21&&!H35'
2016-12-01 14:09:26 -05:00
def jdkMapping = [
2018-10-02 04:15:41 -04:00
'1.6' : 'JDK 1.6 (latest)' ,
2017-09-16 05:08:45 -04:00
'1.8' : 'JDK 1.8 (latest)' ,
2018-04-30 07:21:31 -04:00
'1.10' : 'JDK 10 (latest)' ,
2018-08-19 01:58:31 -04:00
'1.11' : 'JDK 11 (latest)' ,
2018-08-26 07:41:25 -04:00
'1.12' : 'JDK 12 (latest)' ,
2019-01-22 05:07:02 -05:00
'1.13' : 'JDK 13 (latest)' ,
2020-01-10 16:04:14 -05:00
'1.14' : 'JDK 14 (latest)' ,
2017-09-16 05:08:45 -04:00
'IBMJDK' : 'IBM 1.8 64-bit (on Ubuntu only)' ,
2016-12-01 14:09:26 -05:00
]
2017-09-16 05:08:45 -04:00
static def shellEx ( def context , String cmd , def poijob ) {
if ( poijob . windows ) {
context . batchFile ( cmd )
} else {
context . shell ( cmd )
}
2017-07-31 14:21:48 -04:00
}
2017-07-31 18:56:08 -04:00
def defaultDesc = '' '
2018-09-28 13:43:07 -04:00
< img src = "https://poi.apache.org/images/project-header.png" / >
2016-12-01 15:49:29 -05:00
< p >
Apache POI - the Java API for Microsoft Documents
< / p >
< p >
2016-12-30 17:12:14 -05:00
< b > This is an automatically generated Job Config , do not edit it here !
2017-01-30 17:05:29 -05:00
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>,
2016-12-30 17:12:14 -05:00
see < a href = "https://github.com/jenkinsci/job-dsl-plugin/wiki" > https: //github.com/jenkinsci/job-dsl-plugin/wiki</a>
for more details about the DSL . < / b >
2016-12-03 14:50:28 -05:00
< / p > '' '
2017-07-31 18:56:08 -04:00
def apicheckDesc = '' '
2016-12-03 14:50:28 -05:00
< p >
2019-11-13 12:18:15 -05:00
< b > < a href = "https://sonarcloud.io/dashboard?id=poi-parent" target = "_blank" > Sonar reports < /a></ b > -
2016-12-30 17:12:14 -05:00
< p >
< b > < a href = "lastSuccessfulBuild/artifact/build/main/build/reports/japi.html" > API Check POI < /a></ b >
< b > < a href = "lastSuccessfulBuild/artifact/build/ooxml/build/reports/japi.html" > API Check POI - OOXML < /a></ b >
< b > < a href = "lastSuccessfulBuild/artifact/build/excelant/build/reports/japi.html" > API Check POI - Excelant < /a></ b >
< b > < a href = "lastSuccessfulBuild/artifact/build/scratchpad/build/reports/japi.html" > API Check POI - Scratchpad < /a></ b >
2016-12-01 15:49:29 -05:00
< / p >
2016-12-03 14:50:28 -05:00
'' '
2017-07-31 18:56:08 -04:00
def sonarDesc = '' '
2016-12-01 15:49:29 -05:00
< p >
2016-12-30 17:12:14 -05:00
< b > < a href = "lastSuccessfulBuild/findbugsResult/" target = "_blank" > Findbugs report of latest build < /a></ b > -
2019-11-13 12:18:15 -05:00
< b > < a href = "https://sonarcloud.io/dashboard?id=poi-parent" target = "_blank" > Sonar reports < /a></ b > -
2016-12-30 17:12:14 -05:00
< b > < a href = "lastSuccessfulBuild/artifact/build/coverage/index.html" target = "_blank" > Coverage of latest build < /a></ b >
2016-12-01 15:49:29 -05:00
< / p >
2017-07-31 18:56:08 -04:00
'' '
def shellCmdsUnix =
2017-09-16 05:08:45 -04:00
'' ' # show which files are currently modified in the working copy
2019-04-13 09:06:43 -04:00
svn status | | true
2017-07-31 18:56:08 -04:00
# print out information about which exact version of java we are using
echo Java - Home: $JAVA_HOME
ls - al $JAVA_HOME /
2017-10-09 15:35:43 -04:00
ls - al $JAVA_HOME / bin
2017-07-31 18:56:08 -04:00
$JAVA_HOME /bin/ java - version
2017-10-09 15:35:43 -04:00
echo which java
which java
java - version
echo which javac
which javac
javac - version
2019-03-03 09:09:58 -05:00
echo Ant - Home: $ANT_HOME
ls - al $ANT_HOME
echo which ant
2019-04-22 15:32:07 -04:00
which ant | | true
2019-03-03 09:09:58 -05:00
ant - version
2017-10-09 15:35:43 -04:00
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
ant - f build . javacheck . xml - v
2017-07-31 18:56:08 -04:00
POIJOBSHELL
# ignore any error message
exit 0 '' '
def shellCmdsWin =
2017-09-16 05:08:45 -04:00
'' ' @echo off
2017-07-31 18:56:08 -04:00
: : show which files are currently modified in the working copy
svn status
: : print out information about which exact version of java we are using
echo Java - Home: % JAVA_HOME %
dir "%JAVA_HOME:\\\\=\\%"
"%JAVA_HOME%/bin/java" - version
POIJOBSHELL
: : ignore any error message
exit / b 0 '' '
poijobs . each { poijob - >
def jdkKey = poijob . jdk ? : defaultJdk
def trigger = poijob . trigger ? : defaultTrigger
def email = poijob . email ? : defaultEmail
def slaves = poijob . slaves ? : defaultSlaves + ( poijob . slaveAdd ? : '' )
2019-04-22 14:48:35 -04:00
def antRT = poijob . windows ? defaultAntWindows : defaultAnt
2017-07-31 18:56:08 -04:00
job ( poijob . name ) {
if ( poijob . disabled ) {
disabled ( )
}
description ( defaultDesc + ( poijob . apicheck ? apicheckDesc : sonarDesc ) )
2016-12-30 17:12:14 -05:00
logRotator {
numToKeep ( 5 )
artifactNumToKeep ( 1 )
}
label ( slaves )
environmentVariables {
env ( 'LANG' , 'en_US.UTF-8' )
2018-09-28 13:43:07 -04:00
if ( jdkKey = = '1.10' ) {
2018-08-23 05:03:49 -04:00
// when using JDK 9/10 for running Ant, we need to provide more modules for the forbidden-api-checks task
2018-08-26 07:41:25 -04:00
// on JDK 11 and newer there is no such module any more, so do not add it here
2017-08-19 12:31:33 -04:00
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' )
2016-12-01 15:49:29 -05:00
}
2018-07-19 18:55:51 -04:00
env ( 'FORREST_HOME' , poijob . windows ? 'f:\\jenkins\\tools\\forrest\\latest' : '/home/jenkins/tools/forrest/latest' )
2016-12-30 17:12:14 -05:00
}
wrappers {
timeout {
absolute ( 180 )
abortBuild ( )
writeDescription ( 'Build was aborted due to timeout' )
2018-05-28 15:43:19 -04:00
}
preBuildCleanup {
includePattern ( '**/ooxml-lib/ooxml*.jar' )
2020-01-20 19:06:32 -05:00
includePattern ( 'sonar/*/target/**' )
2018-05-28 15:43:19 -04:00
}
2016-12-30 17:12:14 -05:00
if ( poijob . sonar ) {
2019-11-12 19:00:26 -05:00
credentialsBinding {
string ( 'POI_SONAR_TOKEN' , 'sonarcloud-poi' )
}
2016-12-30 17:12:14 -05:00
configure { project - >
project / buildWrappers < < 'hudson.plugins.sonar.SonarBuildWrapper' { }
2016-12-30 15:35:13 -05:00
}
2016-12-01 15:49:29 -05:00
}
2016-12-30 17:12:14 -05:00
}
jdk ( jdkMapping . get ( jdkKey ) )
scm {
2018-12-28 06:17:57 -05:00
if ( poijob . githubpr ) {
git {
remote {
github ( 'apache/poi' )
refspec ( '+refs/pull/*:refs/remotes/origin/pr/*' )
}
branch ( '${sha1}' )
}
} else {
svn ( svnBase ) { svnNode - >
svnNode / browser(class: 'hudson.scm.browsers.ViewSVN') /
url < < 'http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN'
}
2017-09-16 05:08:45 -04:00
}
2016-12-30 17:12:14 -05:00
}
2017-09-16 05:08:45 -04:00
checkoutRetryCount ( 3 )
2018-12-28 06:17:57 -05:00
if ( poijob . githubpr ) {
2018-12-28 15:19:58 -05:00
throttleConcurrentBuilds {
maxPerNode ( 1 )
maxTotal ( 1 )
}
2018-12-28 06:17:57 -05:00
parameters {
2018-12-28 14:52:54 -05:00
/ * plugin not available:
2018-12-28 06:17:57 -05:00
gitParam ( 'sha1' ) {
description ( 'Pull request' )
type ( 'BRANCH' )
2018-12-28 14:52:54 -05:00
} * /
stringParam ( 'sha1' , 'origin/pr/9/head' , 'Provide a branch-spec, e.g. origin/pr/9/head' )
2018-12-28 06:17:57 -05:00
}
triggers {
2019-01-11 14:31:18 -05:00
githubPullRequest {
2018-12-28 06:17:57 -05:00
admins ( [ 'centic9' , 'poi-benchmark' , 'tballison' , 'gagravarr' , 'onealj' , 'pjfanning' , 'Alain-Bearez' ] )
userWhitelist ( [ 'centic9' , 'poi-benchmark' , 'tballison' , 'gagravarr' , 'onealj' , 'pjfanning' , 'Alain-Bearez' ] )
orgWhitelist ( [ 'apache' ] )
cron ( 'H/5 * * * *' )
triggerPhrase ( 'OK to test' )
2019-01-11 14:31:18 -05:00
}
2018-12-28 06:17:57 -05:00
}
} else {
triggers {
scm ( trigger )
}
2016-12-30 17:12:14 -05:00
}
2017-07-31 18:56:08 -04:00
def shellcmds = ( poijob . windows ? shellCmdsWin : shellCmdsUnix ) . replace ( 'POIJOBSHELL' , poijob . shell ? : '' )
2016-12-30 17:12:14 -05:00
// Create steps and publishers depending on the type of Job that is selected
if ( poijob . maven ) {
steps {
2019-11-12 19:00:26 -05:00
shellEx ( delegate , shellcmds , poijob )
maven {
goals ( 'clean' )
rootPOM ( 'sonar/pom.xml' )
localRepository ( LocalRepositoryLocation . LOCAL_TO_WORKSPACE )
mavenInstallation ( defaultMaven )
}
/ * Currently not done , let ' s see if it is still necessary:
# Maven - Download fails for strange reasons , try to workaround . . .
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
* /
maven {
if ( poijob . sonar ) {
2019-12-01 06:42:09 -05:00
goals ( 'clean package sonar:sonar' )
property ( 'sonar.login' , '${POI_SONAR_TOKEN}' )
2019-11-12 19:00:26 -05:00
} else {
goals ( 'package' )
2016-12-17 18:52:48 -05:00
}
2019-11-12 19:00:26 -05:00
rootPOM ( 'sonar/pom.xml' )
mavenOpts ( '-Xmx2g' )
mavenOpts ( '-Xms256m' )
mavenOpts ( '-XX:-OmitStackTraceInFastThrow' )
localRepository ( LocalRepositoryLocation . LOCAL_TO_WORKSPACE )
mavenInstallation ( defaultMaven )
2016-12-17 18:52:48 -05:00
}
2016-12-01 15:49:29 -05:00
}
2016-12-30 17:12:14 -05:00
publishers {
if ( ! poijob . skipcigame ) {
configure { project - >
project / publishers < < 'hudson.plugins.cigame.GamePublisher' { }
}
}
2017-11-23 13:54:17 -05:00
if ( ! poijob . sonar ) {
archiveJunit ( 'sonar/*/target/surefire-reports/TEST-*.xml' ) {
testDataPublishers {
publishTestStabilityData ( )
}
2017-11-21 11:28:07 -05:00
}
}
2016-12-30 17:12:14 -05:00
mailer ( email , false , false )
2016-12-01 15:49:29 -05:00
}
2016-12-30 17:12:14 -05:00
} else if ( poijob . javadoc ) {
steps {
2017-07-31 14:21:48 -04:00
shellEx ( delegate , shellcmds , poijob )
2016-12-30 17:12:14 -05:00
ant {
targets ( [ 'clean' , 'javadocs' ] + ( poijob . properties ? : [ ] ) )
prop ( 'coverage.enabled' , true )
// Properties did not work, so I had to use targets instead
//properties(poijob.properties ?: '')
2017-07-31 11:29:28 -04:00
antInstallation ( antRT )
2016-12-30 17:12:14 -05:00
}
2018-07-19 17:49:49 -04:00
shellEx ( delegate , 'zip -r build/javadocs.zip build/site/apidocs' , poijob )
2016-12-01 15:49:29 -05:00
}
2016-12-30 17:12:14 -05:00
publishers {
if ( ! poijob . skipcigame ) {
configure { project - >
project / publishers < < 'hudson.plugins.cigame.GamePublisher' { }
2016-12-01 15:49:29 -05:00
}
}
2016-12-30 17:12:14 -05:00
mailer ( email , false , false )
}
} else if ( poijob . apicheck ) {
steps {
2017-07-31 14:21:48 -04:00
shellEx ( delegate , shellcmds , poijob )
2016-12-30 17:12:14 -05:00
gradle {
tasks ( 'japicmp' )
2019-09-12 08:06:20 -04:00
useWrapper ( true )
2016-12-30 17:12:14 -05:00
}
}
publishers {
archiveArtifacts ( 'build/*/build/reports/japi.html' )
if ( ! poijob . skipcigame ) {
configure { project - >
2017-03-10 15:13:46 -05:00
project / publishers < < 'hudson.plugins.cigame.GamePublisher' { }
}
}
mailer ( email , false , false )
}
} else if ( poijob . sonar ) {
steps {
2019-11-12 19:00:26 -05:00
shellEx ( delegate , shellcmds , poijob )
2019-11-12 18:30:01 -05:00
2019-11-12 19:00:26 -05:00
gradle {
switches ( '-PenableSonar' )
2019-12-01 06:42:09 -05:00
switches ( '-Dsonar.login=${POI_SONAR_TOKEN}' )
2019-11-12 19:00:26 -05:00
tasks ( 'sonarqube' )
useWrapper ( false )
2017-03-10 15:13:46 -05:00
}
}
publishers {
if ( ! poijob . skipcigame ) {
configure { project - >
2016-12-30 17:12:14 -05:00
project / publishers < < 'hudson.plugins.cigame.GamePublisher' { }
2016-12-01 15:49:29 -05:00
}
}
2016-12-30 17:12:14 -05:00
mailer ( email , false , false )
}
} else {
steps {
2017-07-31 14:21:48 -04:00
shellEx ( delegate , shellcmds , poijob )
2016-12-30 17:12:14 -05:00
if ( poijob . addShell ) {
2017-07-31 14:21:48 -04:00
shellEx ( delegate , poijob . addShell , poijob )
2016-12-30 17:12:14 -05:00
}
// For Jobs that should still have the default set of publishers we can configure different steps here
if ( poijob . gradle ) {
gradle {
tasks ( 'check' )
useWrapper ( false )
}
} else if ( poijob . noScratchpad ) {
2016-12-01 15:49:29 -05:00
ant {
2018-11-17 19:23:49 -05:00
targets ( [ 'clean' , 'compile' ] + ( poijob . properties ? : [ ] ) )
2016-12-30 17:12:14 -05:00
prop ( 'coverage.enabled' , true )
2017-07-31 11:29:28 -04:00
antInstallation ( antRT )
2016-12-30 17:12:14 -05:00
}
ant {
2017-01-26 14:58:29 -05:00
targets ( [ '-Dscratchpad.ignore=true' , 'jacocotask' , 'test-all' , 'testcoveragereport' ] + ( poijob . properties ? : [ ] ) )
2016-12-30 17:19:12 -05:00
prop ( 'coverage.enabled' , true )
2017-07-31 11:29:28 -04:00
antInstallation ( antRT )
2016-12-30 17:12:14 -05:00
}
} else {
ant {
targets ( [ 'clean' , 'jenkins' ] + ( poijob . properties ? : [ ] ) )
2016-12-01 15:49:29 -05:00
prop ( 'coverage.enabled' , true )
// Properties did not work, so I had to use targets instead
//properties(poijob.properties ?: '')
2017-07-31 11:29:28 -04:00
antInstallation ( antRT )
2016-12-01 15:49:29 -05:00
}
2016-12-30 17:12:14 -05:00
ant {
targets ( [ 'run' ] + ( poijob . properties ? : [ ] ) )
buildFile ( 'src/integrationtest/build.xml' )
// Properties did not work, so I had to use targets instead
//properties(poijob.properties ?: '')
2017-07-31 11:29:28 -04:00
antInstallation ( antRT )
2016-12-01 15:49:29 -05:00
}
}
2016-12-30 17:12:14 -05:00
}
publishers {
findbugs ( 'build/findbugs.xml' , false ) {
healthLimits ( 3 , 20 )
thresholdLimit ( 'low' )
defaultEncoding ( 'UTF-8' )
2016-12-01 16:08:22 -05:00
}
2016-12-30 17:12:14 -05:00
// in archive, junit and jacoco publishers, matches beneath build/*/build/... are for Gradle-build results
archiveArtifacts ( 'build/dist/*.tar.gz,build/findbugs.html,build/coverage/**,build/integration-test-results/**,ooxml-lib/**,build/*/build/libs/*.jar' )
warnings ( [ 'Java Compiler (javac)' , 'JavaDoc Tool' ] , null ) {
resolveRelativePaths ( )
2016-12-01 15:49:29 -05:00
}
2017-02-21 01:28:12 -05:00
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' ) {
2016-12-30 17:12:14 -05:00
testDataPublishers {
publishTestStabilityData ( )
2016-12-01 16:08:22 -05:00
}
2016-12-01 15:49:29 -05:00
}
2016-12-30 17:12:14 -05:00
jacocoCodeCoverage {
2016-12-31 04:43:13 -05:00
classPattern ( 'build/classes,build/excelant-classes,build/ooxml-classes,build/scratchpad-classes,build/*/build/classes' )
2016-12-30 17:12:14 -05:00
execPattern ( 'build/*.exec,build/*/build/jacoco/*.exec' )
sourcePattern ( 'src/java,src/excelant/java,src/ooxml/java,src/scratchpad/src' )
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' )
}
2016-12-02 07:52:05 -05:00
2016-12-30 17:12:14 -05:00
if ( ! poijob . skipcigame ) {
configure { project - >
project / publishers < < 'hudson.plugins.cigame.GamePublisher' { }
2016-12-01 15:49:29 -05:00
}
}
2016-12-30 17:12:14 -05:00
mailer ( email , false , false )
2016-12-01 15:49:29 -05:00
}
}
}
2016-11-27 06:06:48 -05:00
}
2017-05-04 04:40:12 -04:00
2018-10-02 04:15:41 -04:00
xmlbeansjobs . each { xjob - >
def jdkKey = xjob . jdk ? : defaultJdk
def trigger = xjob . trigger ? : defaultTrigger
def email = xjob . email ? : defaultEmail
def slaves = xjob . slaves ? : defaultSlaves + ( xjob . slaveAdd ? : '' )
2019-04-22 14:48:35 -04:00
def antRT = xjob . windows ? defaultAntWindows : defaultAnt
2018-10-02 04:15:41 -04:00
job ( xjob . name ) {
if ( xjob . disabled ) {
disabled ( )
}
description ( defaultDesc + ( xjob . apicheck ? apicheckDesc : sonarDesc ) )
logRotator {
numToKeep ( 5 )
artifactNumToKeep ( 1 )
}
label ( slaves )
environmentVariables {
env ( 'LANG' , 'en_US.UTF-8' )
if ( jdkKey = = '1.10' ) {
// when using JDK 9/10 for running Ant, we need to provide more modules for the forbidden-api-checks task
// on JDK 11 and newer there is no such module any more, so do not add it here
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' )
2020-01-10 16:04:14 -05:00
} else if ( jdkKey = = '1.11' | | jdkKey = = '1.12' | | jdkKey = = '1.13' | | jdkKey = = '1.14' ) {
2019-03-03 09:09:58 -05:00
env ( 'ANT_OPTS' , '--add-opens=java.xml/com.sun.org.apache.xerces.internal.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED' )
2018-10-02 04:15:41 -04:00
}
2019-03-03 09:09:58 -05:00
// will be needed for forbidden-apis-check: env('ANT_HOME', xjob.windows ? 'f:\\jenkins\\tools\\ant\\latest' : '/usr/share/ant')
2018-10-02 04:15:41 -04:00
env ( 'FORREST_HOME' , xjob . windows ? 'f:\\jenkins\\tools\\forrest\\latest' : '/home/jenkins/tools/forrest/latest' )
}
wrappers {
timeout {
absolute ( 180 )
abortBuild ( )
writeDescription ( 'Build was aborted due to timeout' )
}
}
jdk ( jdkMapping . get ( jdkKey ) )
scm {
svn ( xmlbeansSvnBase ) { svnNode - >
svnNode / browser(class: 'hudson.scm.browsers.ViewSVN') /
url < < 'http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN'
}
}
checkoutRetryCount ( 3 )
triggers {
scm ( trigger )
}
2018-10-02 10:55:09 -04:00
def shellcmds = ( xjob . windows ? shellCmdsWin : shellCmdsUnix ) . replace ( 'POIJOBSHELL' , xjob . shell ? : '' )
2018-10-02 04:15:41 -04:00
// Create steps and publishers depending on the type of Job that is selected
steps {
shellEx ( delegate , shellcmds , xjob )
if ( xjob . addShell ) {
shellEx ( delegate , xjob . addShell , xjob )
}
ant {
targets ( [ 'clean' ] )
antInstallation ( antRT )
}
ant {
2019-03-03 09:09:58 -05:00
targets ( [ 'jenkins' ] )
2018-10-02 18:36:25 -04:00
antInstallation ( antRT )
}
2018-10-02 04:15:41 -04:00
}
publishers {
2019-01-19 06:50:14 -05:00
archiveArtifacts ( 'build/**' )
2018-10-02 04:15:41 -04:00
2019-03-03 09:09:58 -05:00
warnings ( [ 'Java Compiler (javac)' , 'JavaDoc Tool' ] , null ) {
resolveRelativePaths ( )
}
archiveJunit ( 'build/test-results/TEST-*.xml' ) {
testDataPublishers {
publishTestStabilityData ( )
}
}
2018-10-02 04:15:41 -04:00
if ( ! xjob . skipcigame ) {
configure { project - >
project / publishers < < 'hudson.plugins.cigame.GamePublisher' { }
}
}
mailer ( email , false , false )
}
}
}
2017-09-17 07:07:21 -04:00
/ *
Add a special job which spans a two - dimensional matrix of all JDKs that we want to use and
all slaves that we would like to use and test if the java and ant binaries are available
on that machine correctly .
* /
2017-09-16 05:08:45 -04:00
matrixJob ( 'POI-DSL-Test-Environment' ) {
description (
2018-11-16 17:28:23 -05:00
'' ' Check installed version of Java / Ant on all build - nodes
2017-09-16 05:08:45 -04:00
This job is used to verify which machines actually have the required programs installed .
2018-11-16 17:28:23 -05:00
Unfortunately we often see builds break because of changes / new machines . . . '' ' )
2017-09-16 05:08:45 -04:00
/ * throttleConcurrentBuilds {
maxPerNode ( 1 )
maxTotal ( 1 )
} * /
logRotator {
2018-11-16 17:28:23 -05:00
numToKeep ( 1 )
2017-09-16 05:08:45 -04:00
artifactNumToKeep ( 1 )
}
axes {
jdk (
'JDK 1.8 (latest)' ,
'IBM 1.8 64-bit (on Ubuntu only)' ,
2018-08-19 01:58:31 -04:00
'JDK 11 (latest)' ,
2018-08-26 07:41:25 -04:00
'JDK 12 (latest)' ,
2019-10-26 01:37:32 -04:00
'JDK 13 (latest)' ,
'JDK 14 (latest)'
2017-09-16 05:08:45 -04:00
)
2019-01-11 14:31:18 -05:00
elasticAxis {
2018-11-16 17:28:23 -05:00
name ( 'Nodes' )
labelString ( '!cloud-slave&&!H15&&!H17&&!H18&&!H24&&!ubuntu-4&&!H21&&!H35&&!websites1&&!couchdb&&!plc4x&&!ppc64le' )
ignoreOffline ( true )
2019-01-11 14:31:18 -05:00
}
2017-09-16 05:08:45 -04:00
}
steps {
2018-11-16 17:28:23 -05:00
conditionalSteps {
condition {
fileExists ( '/usr' , BaseDir . WORKSPACE )
runner ( 'DontRun' )
steps {
shell (
2019-04-13 09:06:43 -04:00
'' ' which svn | | true
2019-04-13 03:41:21 -04:00
which javac
2017-09-16 05:08:45 -04:00
javac - version
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
'' ' )
2018-11-16 17:28:23 -05:00
ant {
antInstallation ( defaultAnt )
}
2017-09-16 05:08:45 -04:00
2019-10-26 01:37:32 -04:00
shell (
'' ' which mvn | | true
2019-10-26 02:35:15 -04:00
mvn - version | | true
2019-10-26 14:17:38 -04:00
echo '<project><modelVersion>4.0.0</modelVersion><groupId>org.apache.poi</groupId><artifactId>build-tst</artifactId><version>1.0.0</version></project>' > pom . xml
2019-10-26 01:37:32 -04:00
'' ' )
maven {
goals ( 'package' )
mavenInstallation ( defaultMaven )
}
2018-11-16 17:28:23 -05:00
}
}
}
conditionalSteps {
condition {
fileExists ( 'c:\\windows' , BaseDir . WORKSPACE )
runner ( 'DontRun' )
steps {
2019-01-11 14:31:18 -05:00
batchFile {
2018-11-16 17:28:23 -05:00
command (
'' ' @echo off
echo .
where javac . exe
echo .
javac - version
echo .
2019-01-27 16:17:01 -05:00
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
2018-11-16 17:28:23 -05:00
'' ' )
2019-01-11 14:31:18 -05:00
}
2018-11-16 17:28:23 -05:00
ant {
2019-04-22 14:48:35 -04:00
antInstallation ( defaultAntWindows )
2018-11-16 17:28:23 -05:00
}
}
}
}
2017-09-16 05:08:45 -04:00
}
}
2017-05-04 04:52:44 -04:00
/* I tried to put the view into a sub-folder/ sub - view , but failed , there are multiple related
plugins so this is all a bit confusing : ( , see also https: //issues.apache.org/jira/browse/INFRA-14002
2017-05-04 04:40:12 -04:00
dashboardView ( "P/POI-new" ) {
columns {
status ( )
weather ( )
configureProject ( )
buildButton ( )
cronTrigger ( )
lastBuildConsole ( )
name ( )
lastSuccess ( )
lastFailure ( )
lastDuration ( )
//lastSuccessDescription()
jacoco ( )
}
2018-10-26 05:32:13 -04:00
description ( "<table>\n" +
" <tr>\n" +
" <td><img src=\"https://poi.apache.org/images/project-header.png\" /></td>\n" +
" <td> \n" +
" <p>Apache POI - the Java API for Microsoft Documents</p>\n" +
" <p><b>Most of the POI Jobs are automatically generated by Jenkins Job DSL\n" +
" at <a href=\"https://svn.apache.org/repos/asf/poi/trunk/jenkins\">https://svn.apache.org/repos/asf/poi/trunk/jenkins</a>,<br/>\n" +
" see <a href=\"https://github.com/jenkinsci/job-dsl-plugin/wiki\">https://github.com/jenkinsci/job-dsl-plugin/wiki</a>\n" +
" for more details about the DSL.</b>\n" +
" </p>\n" +
" <p>\n" +
" <b><a href=\"job/POI-DSL-1.8/lastSuccessfulBuild/findbugsResult/\" target=\"_blank\">Findbugs report of latest build</a></b> -\n" +
2019-11-13 12:18:15 -05:00
" <b><a href=\"https://sonarcloud.io/dashboard?id=poi-parent\" target=\"_blank\">Sonar reports</a></b> -\n" +
2018-10-26 05:32:13 -04:00
" <b><a href=\"job/POI-DSL-1.8/lastSuccessfulBuild/artifact/build/coverage/index.html\" target=\"_blank\">Coverage of latest build</a></b>\n" +
" </p>\n" +
" </td>\n" +
" </tr>\n" +
"</table>" )
2017-05-04 04:52:44 -04:00
filterBuildQueue ( false )
2017-05-04 04:40:12 -04:00
filterExecutors ( false )
// Job selection
2017-05-04 04:52:44 -04:00
jobs { * /
2017-09-16 05:08:45 -04:00
//regex(/.*POI.*/)
/ * }
2017-05-04 04:40:12 -04:00
2017-09-16 05:08:45 -04:00
// Layout
topPortlets {
jenkinsJobsList {
displayName ( 'POI jobs' )
2017-05-04 04:40:12 -04:00
}
2017-09-16 05:08:45 -04:00
}
leftPortlets {
testStatisticsChart ( )
}
rightPortlets {
testTrendChart ( )
}
bottomPortlets {
testStatisticsGrid ( )
buildStatistics ( )
}
2017-05-04 04:52:44 -04:00
} * /