You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jspwiki.apache.org by ju...@apache.org on 2021/12/02 21:55:23 UTC
[jspwiki] 05/26: Moved site generation to jspwiki-site
This is an automated email from the ASF dual-hosted git repository.
juanpablo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jspwiki.git
commit 1b069ea22aab085d18e1b553dc1b199e5440ae7f
Author: Juan Pablo Santos RodrÃguez <ju...@gmail.com>
AuthorDate: Fri Nov 26 22:16:19 2021 +0100
Moved site generation to jspwiki-site
* CI feedback should be gathered faster, launching the site building job if the branch pushed is master
* Site's building job can also be triggered manually
---
Jenkinsfile | 95 +++++++++++++------------------------------------------------
1 file changed, 19 insertions(+), 76 deletions(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index e91e07a..9a77911 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -18,91 +18,28 @@
*/
buildRepo = 'https://github.com/apache/jspwiki'
-siteRepo = 'https://gitbox.apache.org/repos/asf/jspwiki-site.git'
-creds = '9b041bd0-aea9-4498-a576-9eeb771411dd'
-
-asfsite = 'asf-site'
-build = 'build'
buildJdk8 = 'jdk_1.8_latest'
buildJdk11 = 'jdk_11_latest'
buildJdk17 = 'jdk_17_latest'
buildMvn = 'maven_3_latest'
errMsg = ''
-jbake = 'jbake'
try {
- def pom
stage( "build source" ) {
parallel jdk11Build: {
- node( 'ubuntu' ) {
- stage( buildJdk11 ) {
- cleanWs()
- dir( build ) {
- git url: buildRepo, poll: true
- if( env.BRANCH_NAME == 'master' ) {
- buildJSPWiki( '-Pattach-additional-artifacts -Djdk.javadoc.doclet.version=2.0.15' )
- pom = readMavenPom file: 'pom.xml'
- writeFile file: 'target/classes/apidocs.txt', text: 'file created in order to allow aggregated javadoc generation, target/classes is needed for all modules'
- writeFile file: 'jspwiki-it-tests/target/classes/apidocs.txt', text: 'file created in order to allow aggregated javadoc generation, target/classes is needed for all modules'
- withMaven( jdk: buildJdk11, maven: buildMvn, publisherStrategy: 'EXPLICIT' ) {
- sh 'mvn package javadoc:aggregate-no-fork -DskipTests -pl !jspwiki-portable -Djdk.javadoc.doclet.version=2.0.15'
- sh 'java -cp jspwiki-main/target/classes org.apache.wiki.TranslationsCheck site'
- }
- } else {
- buildJSPWiki()
- }
- }
- }
-
- stage( 'build website' ) {
- if( env.BRANCH_NAME == 'master' ) {
- withMaven( jdk: buildJdk8, maven: buildMvn, publisherStrategy: 'EXPLICIT' ) {
- dir( jbake ) {
- git branch: jbake, url: siteRepo, credentialsId: creds, poll: false
- sh "cp ../$build/ChangeLog.md ./src/main/config/changelog.md"
- sh "cp ../$build/i18n-table.txt ./src/main/config/i18n-table.md"
- sh "cat ./src/main/config/changelog-header.txt ./src/main/config/changelog.md > ./src/main/jbake/content/development/changelog.md"
- sh "cat ./src/main/config/i18n-header.txt ./src/main/config/i18n-table.md > ./src/main/jbake/content/development/i18n.md"
- sh 'mvn clean process-resources -Dplugin.japicmp.jspwiki-new=' + pom.version
- }
- stash name: 'jbake-website'
- }
- }
- }
- }
+ buildAndSonarWith( buildJdk11 )
},
jdk8Build: {
- reducedBuildWith( buildJdk8 )
+ buildWith( buildJdk8 )
},
jdk17Build: {
- reducedBuildWith( buildJdk17 )
+ buildWith( buildJdk17 )
}
}
- stage( 'publish website' ) {
- if( env.BRANCH_NAME == 'master' ) {
- node( 'git-websites' ) {
- cleanWs()
- unstash 'jbake-website'
- dir( asfsite ) {
- git branch: asfsite, url: siteRepo, credentialsId: creds, poll: false
- sh "cp -rf ../$jbake/target/content/* ./"
- }
- def apidocs = asfsite + '/apidocs/' + pom.version
- dir( apidocs ) {
- sh "cp -rf ../../../$build/target/site/apidocs/* ."
- }
- dir( asfsite ) {
- timeout( 15 ) { // 15 minutes
- sh 'git add .'
- sh 'git commit -m "Automatic Site Publish by Buildbot"'
- echo "pushing to $siteRepo"
- sh 'git push origin asf-site'
- }
- }
- }
- }
+ if( env.BRANCH_NAME == 'master' ) {
+ build wait: false, job: 'site', parameters: [ text( name: 'version', value: 'master' ) ]
}
currentBuild.result = 'SUCCESS'
@@ -125,22 +62,28 @@ try {
}
}
-def buildJSPWiki( buildOpts = '' ) {
- withMaven( jdk: buildJdk11, maven: buildMvn, publisherStrategy: 'EXPLICIT', options: [ jacocoPublisher(), junitPublisher() ] ) {
- withCredentials( [ string( credentialsId: 'sonarcloud-jspwiki', variable: 'SONAR_TOKEN' ) ] ) {
- def sonarOptions = "-Dsonar.projectKey=jspwiki-builder -Dsonar.organization=apache -Dsonar.branch.name=${env.BRANCH_NAME} -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=$SONAR_TOKEN"
- echo 'Will use SonarQube instance at https://sonarcloud.io'
- sh "mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent package org.jacoco:jacoco-maven-plugin:report sonar:sonar $sonarOptions $buildOpts -T 1C"
+def buildAndSonarWith( jdk ) {
+ node( 'ubuntu' ) {
+ stage( jdk ) {
+ cleanWs()
+ git url: buildRepo, poll: true
+ withMaven( jdk: jdk, maven: buildMvn, publisherStrategy: 'EXPLICIT', options: [ jacocoPublisher(), junitPublisher() ] ) {
+ withCredentials( [ string( credentialsId: 'sonarcloud-jspwiki', variable: 'SONAR_TOKEN' ) ] ) {
+ def sonarOptions = "-Dsonar.projectKey=jspwiki-builder -Dsonar.organization=apache -Dsonar.branch.name=${env.BRANCH_NAME} -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=$SONAR_TOKEN"
+ echo 'Will use SonarQube instance at https://sonarcloud.io'
+ sh "mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent package org.jacoco:jacoco-maven-plugin:report sonar:sonar $sonarOptions -T 1C"
+ }
+ }
}
}
}
-def reducedBuildWith( jdk ) {
+def buildWith( jdk ) {
node( 'ubuntu' ) {
stage( jdk ) {
cleanWs()
git url: buildRepo, poll: true
- withMaven( jdk: jdk, maven: buildMvn, publisherStrategy: 'EXPLICIT', options: [] ) {
+ withMaven( jdk: jdk, maven: buildMvn, publisherStrategy: 'EXPLICIT' ) {
sh 'mvn clean package -T 1C'
}
}