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 2018/10/09 18:38:37 UTC

[jspwiki-site] branch jbake updated: usable version of Jenkinsfile to build and deploy jspwiki.apache.org

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


The following commit(s) were added to refs/heads/jbake by this push:
     new 5972238  usable version of Jenkinsfile to build and deploy jspwiki.apache.org
5972238 is described below

commit 59722382423250b7b20ec2d7882fc410ebbc50a5
Author: Juan Pablo Santos Rodríguez <ju...@gmail.com>
AuthorDate: Tue Oct 9 20:37:54 2018 +0200

    usable version of Jenkinsfile to build and deploy jspwiki.apache.org
    
    turns out that to get push privileges, git clone had to be done on git-website nodes
    tidyed up the build process to depict only the logical steps
---
 Jenkinsfile | 37 ++++++++++++++++++-------------------
 1 file changed, 18 insertions(+), 19 deletions(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index b38bf3c..b966e24 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -30,42 +30,36 @@ try {
         def MAVEN_3_LATEST=tool name: 'Maven 3 (latest)', type: 'hudson.tasks.Maven$MavenInstallation'
         echo "Will use Maven $MAVEN_3_LATEST"
         
-        stage( "clone $jbake and $asfsite branches" ) {
+        stage( "clone $jbake branch" ) {
             cleanWs()
             dir( jbake ) {
-                git branch: jbake, url: repo, credentialsId: creds
-            }
-            dir( asfsite ) {
-                git branch: asfsite, url: repo, credentialsId: creds
+                git branch: jbake, url: repo, credentialsId: creds, poll: true
             }
         }
 
-        stage( 'generate site' ) {
+        stage( 'build website' ) {
             withEnv( [ "Path+JDK=$JAVA_JDK_8/bin", "Path+MAVEN=$MAVEN_3_LATEST/bin", "JAVA_HOME=$JAVA_JDK_8" ] ) {
                 dir( jbake ) {
                     sh 'mvn clean process-resources'
                 }
-                stash name: 'workspace',
-                      useDefaultExcludes: false, // we need .git to publish
-                      excludes: '**/*~,**/#*#,**/%*%,**/._*,.DS_Store'
+                stash name: 'jbake-website'
             }
         }
         
     } 
 
     node( 'git-websites' ) {
-        stage( 'retrieve workspace' ) {
+        stage( 'publish website' ) {
             cleanWs()
-            unstash 'workspace'
-        }
-        stage( 'publish site' ) {
+            unstash 'jbake-website'
             dir( asfsite ) {
+                git branch: asfsite, url: repo, credentialsId: creds
                 sh "cp -rf ../$jbake/target/content/* ./"
-                sshagent( [ creds ] ) {
+                timeout( 15 ) { // 15 minutes
                     sh 'git add .'
                     sh 'git commit -m "Automatic Site Publish by Buildbot"'
                     echo "pushing to $repo"
-                    sh "git push $repo asf-site"
+                    sh "git push origin asf-site"
                 }
             }
         }
@@ -77,8 +71,13 @@ try {
     echo err
     currentBuild.result = 'FAILURE'
 } finally {
-    emailext body: "See ${env.BUILD_URL}",
-             replyTo: 'dev@jspwiki.apache.org', 
-             to: 'commits@jspwiki.apache.org',
-             subject: "[${env.JOB_NAME}] build ${env.BUILD_DISPLAY_NAME} - ${currentBuild.result}"
+    node( 'ubuntu' ) {
+        if( currentBuild.result == null ) {
+            currentBuild.result = 'ABORTED'
+        }
+        emailext body: "See ${env.BUILD_URL}",
+                 replyTo: 'dev@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