offline building of site deploy to improve performance.
[utils] / Jenkinsfile
1 String cron_string = BRANCH_NAME == "trunk" ? "10 3 * * *" : ""
2
3
4 pipeline {
5   agent {
6     kubernetes agentsetup(containers: 'java8') 
7   }
8   options {
9     disableConcurrentBuilds()
10   }
11   triggers { cron(cron_string) }
12   
13   stages {
14     stage('Main') {
15       steps {  
16         sh '''
17           export
18           #rm -rf ~/.m2/repository/org/wamblee
19
20           mvn install
21
22           for sitexml in $( find . -name site.xml ) 
23           do
24             dir=$( dirname $sitexml )
25             dir=$( dirname $dir )
26             dir=$( dirname $dir ) 
27             ( 
28               cd $dir
29               echo ""
30               echo "Building site for $dir"
31               echo ""
32               mvn -N -o -Ddistrib=/data/www/http.utils.wamblee.org/ site site:deploy
33               echo ""
34               echo ""
35             )
36           done
37           mvn javadoc:aggregate
38
39           rsync -av --delete target/site/apidocs/ /data/www/http.wamblee.org/apidocs/
40      
41           cp src/site/index.html /data/www/http.utils.wamblee.org/
42
43         '''
44       }
45     }
46   }
47   post {
48     always {
49       junit '**/surefire-reports/*.xml'
50       cobertura coberturaReportFile: '**/target/site/cobertura/coverage.xml'
51     }
52     changed {
53       mail to: "jenkins@wamblee.org",
54       subject: "jenkins build:${currentBuild.currentResult}: ${env.JOB_NAME}",
55       body: "${currentBuild.currentResult}: Job ${env.JOB_NAME}\nMore Info can be found here: ${env.BUILD_URL}"
56     }
57   }
58 }