You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@community.apache.org by bd...@apache.org on 2023/04/21 08:46:43 UTC

[comdev-site] branch preview/test0421 created (now 162a434)

This is an automated email from the ASF dual-hosted git repository.

bdelacretaz pushed a change to branch preview/test0421
in repository https://gitbox.apache.org/repos/asf/comdev-site.git


      at 162a434  Testing Jenkinsfile fixes for preview

This branch includes the following new commits:

     new 162a434  Testing Jenkinsfile fixes for preview

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[comdev-site] 01/01: Testing Jenkinsfile fixes for preview

Posted by bd...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

bdelacretaz pushed a commit to branch preview/test0421
in repository https://gitbox.apache.org/repos/asf/comdev-site.git

commit 162a434424e339e78fd90c0132702e546ccf3d0c
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Fri Apr 21 10:46:23 2023 +0200

    Testing Jenkinsfile fixes for preview
---
 Jenkinsfile      | 39 ++++++++++++++++++++++++++++++++++++++-
 source/_index.md |  2 ++
 2 files changed, 40 insertions(+), 1 deletion(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index 43ce8b1..5ddac2f 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -24,6 +24,7 @@ pipeline {
    
     environment {
         DEPLOY_BRANCH = 'asf-site'
+        STAGING_BRANCH = "${env.BRANCH_NAME}-staging"
         HUGO_VERSION = '0.111.3'
         HUGO_HASH = 'b382aacb522a470455ab771d0e8296e42488d3ea4e61fe49c11c32ec7fb6ee8b'
         PAGEFIND_VERSION = '0.12.0'
@@ -90,7 +91,7 @@ pipeline {
                     // Remove the content of the target branch and replace it with the content of the temp folder
                     sh """
                         rm -rf ${WORKSPACE}/content
-                        git rm -r --cached content/*
+                        git rm -r --ignore-unmatch --cached content/*
                         mkdir -p ${WORKSPACE}/content
                         cp -rT ${env.TMP_DIR}/* ${WORKSPACE}/content
                     """
@@ -108,6 +109,42 @@ pipeline {
                 }
             }
         }
+        stage('Staging') {
+            // Mostly duplicated from the Deploy branch, there must be a better way...
+            when {
+                not {
+                    branch 'main'
+                }
+            }
+            steps {
+                script {
+                    // Checkout branch with generated content
+                    sh """
+                        git checkout ${STAGING_BRANCH}
+                        git pull origin ${STAGING_BRANCH}
+                    """
+
+                    // Remove the content of the target branch and replace it with the content of the temp folder
+                    sh """
+                        rm -rf ${WORKSPACE}/content
+                        git rm -r --ignore-unmatch --cached content/*
+                        mkdir -p ${WORKSPACE}/content
+                        cp -rT ${env.TMP_DIR}/* ${WORKSPACE}/content
+                    """
+
+                    // Commit the changes to the target branch
+                    env.COMMIT_MESSAGE1 = "Updated ${STAGING_BRANCH} from ${BRANCH_NAME} at ${env.LAST_SHA}"
+                    env.COMMIT_MESSAGE2 = "Built from ${BUILD_URL}"
+                    sh """
+                        git add -A
+                        git commit -m "${env.COMMIT_MESSAGE1}" -m "${env.COMMIT_MESSAGE2}" | true
+                    """
+
+                    // Push the generated content for deployment
+                    sh "git push -u origin ${STAGING_BRANCH}"
+                }
+            }
+        }
     }
     
     post {
diff --git a/source/_index.md b/source/_index.md
index 1e1ab6d..677d28c 100644
--- a/source/_index.md
+++ b/source/_index.md
@@ -30,6 +30,8 @@ in the specific Apache projects that interest you.
 
 </div>
 
+<h1>PREVIEW TEST 2023-04-21</h1>
+
 <a name="Index-Startingpoints"></a>