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/11/22 16:54:57 UTC
[jspwiki-site] 03/03: Allow Jenkinsfile to generate apidocs & japicmp reports for specific tags - build is now parameterized
This is an automated email from the ASF dual-hosted git repository.
juanpablo pushed a commit to branch jbake
in repository https://gitbox.apache.org/repos/asf/jspwiki-site.git
commit 20ceca6f3d6aacbd06b17c7b2b7521b3565a2b2e
Author: Juan Pablo Santos RodrÃguez <ju...@gmail.com>
AuthorDate: Mon Nov 22 17:52:51 2021 +0100
Allow Jenkinsfile to generate apidocs & japicmp reports for specific tags - build is now parameterized
---
Jenkinsfile | 70 +++++++++++++++++++++++++++++++++++++++++++++----------------
1 file changed, 52 insertions(+), 18 deletions(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 4da111c..a472d1d 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -17,36 +17,65 @@
* under the License.
*/
+repo = 'https://gitbox.apache.org/repos/asf/jspwiki-site.git'
+buildRepo = 'https://github.com/apache/jspwiki'
+creds = '9b041bd0-aea9-4498-a576-9eeb771411dd'
+asfsite = 'asf-site'
+build = 'build'
+jbake = 'jbake'
+errMsg = ''
+
try {
- def repo = 'https://gitbox.apache.org/repos/asf/jspwiki-site.git'
- def creds = '9b041bd0-aea9-4498-a576-9eeb771411dd'
- def asfsite = 'asf-site'
- def jbake = 'jbake'
node( 'ubuntu' ) {
def JAVA_JDK_8=tool name: 'jdk_1.8_latest', type: 'hudson.model.JDK'
- echo "Will use Java $JAVA_JDK_8"
-
+ def JAVA_JDK_11=tool name: 'jdk_11_latest', type: 'hudson.model.JDK'
def MAVEN_3_LATEST=tool name: 'maven_3_latest', type: 'hudson.tasks.Maven$MavenInstallation'
- echo "Will use Maven $MAVEN_3_LATEST"
-
- stage( "clone $jbake branch" ) {
+ def version = params?.version ?: 'master'
+ def pom
+
+ stage( 'clean workspace' ) {
cleanWs()
- dir( jbake ) {
- git branch: jbake, url: repo, credentialsId: creds, poll: true
+ }
+
+ stage( 'generate apidocs & translations' ) {
+ echo "Will use Java $JAVA_JDK_11"
+ echo "Will use Maven $MAVEN_3_LATEST"
+ def gitVersion = version != 'master' ? "refs/tags/$version" : ''
+
+ dir( build ) {
+ checkout( [
+ scm: [
+ $class: 'GitSCM',
+ branches: [[ name: gitVersion ]],
+ extensions: [[$class: 'CloneOption', shallow: false, depth: 0, reference: '' ]],
+ userRemoteConfigs: [[url: buildRepo ]]
+ ]
+ ] )
+ 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'
+ withEnv( [ "Path+JDK=$JAVA_JDK_11/bin", "Path+MAVEN=$MAVEN_3_LATEST/bin", "JAVA_HOME=$JAVA_JDK_11" ] ) {
+ 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'
+ }
}
}
stage( 'build website' ) {
+ echo "Will use Java $JAVA_JDK_8"
+ echo "Will use Maven $MAVEN_3_LATEST"
withEnv( [ "Path+JDK=$JAVA_JDK_8/bin", "Path+MAVEN=$MAVEN_3_LATEST/bin", "JAVA_HOME=$JAVA_JDK_8" ] ) {
+ def jbakeVersion = version != 'master' ? " -Dplugin.japicmp.jspwiki-new=$version" : pom.version
dir( jbake ) {
- sh 'mvn clean process-resources'
+ git branch: jbake, url: repo, credentialsId: creds, poll: true
+ sh 'mvn clean process-resources $jbakeVersion'
}
stash name: 'jbake-website'
}
}
-
- }
+
+ }
node( 'git-websites' ) {
stage( 'publish website' ) {
@@ -55,6 +84,10 @@ try {
dir( asfsite ) {
git branch: asfsite, url: repo, credentialsId: creds
sh "cp -rf ../$jbake/target/content/* ./"
+ if( version != 'master' ) {
+ def apidocsVersion = version != 'master' ? version : pom.version
+ sh "mkdir -p ./apidocs/$apidocsVersion && cp -rf ../$build/target/site/apidocs/* ./apidocs/$apidocsVersion"
+ }
timeout( 15 ) { // 15 minutes
sh 'git add .'
sh 'git commit -m "Automatic Site Publish by Buildbot"'
@@ -64,19 +97,20 @@ try {
}
}
}
-
+
currentBuild.result = 'SUCCESS'
-
+
} catch( Exception err ) {
currentBuild.result = 'FAILURE'
echo err.message
+ errMsg = '- ' + err.message
} finally {
node( 'ubuntu' ) {
if( currentBuild.result == null ) {
currentBuild.result = 'ABORTED'
}
- emailext body: "See ${env.BUILD_URL}",
- replyTo: 'dev@jspwiki.apache.org',
+ emailext body: "See ${env.BUILD_URL} $errMsg",
+ replyTo: 'dev@jspwiki.apache.org',
to: 'commits@jspwiki.apache.org',
subject: "[${env.JOB_NAME}] build ${env.BUILD_DISPLAY_NAME} - ${currentBuild.result}"
}