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 bf467b2dec6ea4dab0597e25c834b793f89a8bdd Author: Juan Pablo Santos RodrÃguez <juanpablo.san...@gmail.com> AuthorDate: Wed Jan 4 12:56:35 2023 +0100 Add some colors to jenkins' console builds --- Jenkinsfile | 146 ++++++++++++++++++++++++++++++------------------------------ 1 file changed, 74 insertions(+), 72 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 669a4599ae..e9bce0711f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -25,95 +25,97 @@ build = 'build' jbake = 'jbake' errMsg = '' -try { +ansiColor( 'xterm' ) { + try { - def pom - def docsVersion + def pom + def docsVersion - node( 'ubuntu' ) { - 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' - def version = params?.version ?: 'master' + node( 'ubuntu' ) { + 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' + def version = params?.version ?: 'master' - stage( 'clean workspace' ) { - cleanWs() - } + stage( 'clean workspace' ) { + cleanWs() + } - 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" : '*/master' + 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" : '*/master' - 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' - docsVersion = version != 'master' ? version : pom.version - 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 -T 1C' - sh 'java -cp jspwiki-main/target/classes org.apache.wiki.TranslationsCheck site' + 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' + docsVersion = version != 'master' ? version : pom.version + 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 -T 1C' + sh 'java -cp jspwiki-main/target/classes org.apache.wiki.TranslationsCheck site' + } } } - } - stage( 'build website' ) { - echo "Will use Java $JAVA_JDK_11" - echo "Will use Maven $MAVEN_3_LATEST" - withEnv( [ "Path+JDK=$JAVA_JDK_11/bin", "Path+MAVEN=$MAVEN_3_LATEST/bin", "JAVA_HOME=$JAVA_JDK_11" ] ) { - dir( jbake ) { - git branch: jbake, url: repo, credentialsId: creds, poll: true - 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=$docsVersion" + stage( 'build website' ) { + echo "Will use Java $JAVA_JDK_11" + echo "Will use Maven $MAVEN_3_LATEST" + withEnv( [ "Path+JDK=$JAVA_JDK_11/bin", "Path+MAVEN=$MAVEN_3_LATEST/bin", "JAVA_HOME=$JAVA_JDK_11" ] ) { + dir( jbake ) { + git branch: jbake, url: repo, credentialsId: creds, poll: true + 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=$docsVersion" + } } + stash name: 'build' } - stash name: 'build' } - } - node( 'git-websites' ) { - stage( 'publish website' ) { - cleanWs() - unstash 'build' - dir( asfsite ) { - git branch: asfsite, url: repo, credentialsId: creds - sh "cp -rf ../$jbake/target/content/* ./" - sh "rm -rf ./japicmp/$docsVersion && mkdir -p ./japicmp/$docsVersion && cp -rf ../$jbake/target/japicmp/* ./japicmp/$docsVersion" - sh "rm -rf ./apidocs/$docsVersion && mkdir -p ./apidocs/$docsVersion && cp -rf ../$build/target/site/apidocs/* ./apidocs/$docsVersion" - timeout( 15 ) { // 15 minutes - sh 'git add .' - sh 'git commit -m "Automatic Site Publish by Buildbot"' - echo "pushing to $repo" - sh "git push origin asf-site" + node( 'git-websites' ) { + stage( 'publish website' ) { + cleanWs() + unstash 'build' + dir( asfsite ) { + git branch: asfsite, url: repo, credentialsId: creds + sh "cp -rf ../$jbake/target/content/* ./" + sh "rm -rf ./japicmp/$docsVersion && mkdir -p ./japicmp/$docsVersion && cp -rf ../$jbake/target/japicmp/* ./japicmp/$docsVersion" + sh "rm -rf ./apidocs/$docsVersion && mkdir -p ./apidocs/$docsVersion && cp -rf ../$build/target/site/apidocs/* ./apidocs/$docsVersion" + timeout( 15 ) { // 15 minutes + sh 'git add .' + sh 'git commit -m "Automatic Site Publish by Buildbot"' + echo "pushing to $repo" + sh "git push origin asf-site" + } } } } - } - currentBuild.result = 'SUCCESS' + 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' + } 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} $errMsg", + replyTo: 'd...@jspwiki.apache.org', + to: 'commits@jspwiki.apache.org', + subject: "[${env.JOB_NAME}] build ${env.BUILD_DISPLAY_NAME} - ${currentBuild.result}" } - emailext body: "See ${env.BUILD_URL} $errMsg", - replyTo: 'd...@jspwiki.apache.org', - to: 'commits@jspwiki.apache.org', - subject: "[${env.JOB_NAME}] build ${env.BUILD_DISPLAY_NAME} - ${currentBuild.result}" } } \ No newline at end of file