You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@community.apache.org by se...@apache.org on 2023/04/26 20:58:53 UTC

[comdev-site] branch preview/test3 updated: Try tidied file

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

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


The following commit(s) were added to refs/heads/preview/test3 by this push:
     new 2b47ee9  Try tidied file
2b47ee9 is described below

commit 2b47ee9121a67db30bd77c06b9e8a9053c5f1f8d
Author: Sebb <se...@apache.org>
AuthorDate: Wed Apr 26 21:58:44 2023 +0100

    Try tidied file
---
 Jenkinsfile | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index 50b5163..8ae20b1 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -78,15 +78,24 @@ pipeline {
         // branch uses Ant-style patterns by default:
         // https://ant.apache.org/manual/dirtasks.html#patterns
         // Exclude branches ending in '-staging'
+        // Also try to prevent deploy of top-level branches apart from main
         stage('Deploy') {
             when {
                 not {
-                  branch '**/*-staging'
+                    branch '**/*-staging'
                 }
+                anyOf {
+                    branch 'main'
+                    not {
+                      branch '*'
+                    }
+                }        
             }
+
             steps {
                 script {
                     // Checkout branch with generated content, creating it if necessary
+                    // We only want the generated content + .asf.yaml
                     sh """
                         if git checkout ${DEPLOY_BRANCH}
                         then
@@ -100,7 +109,7 @@ pipeline {
                           git add .asf.yaml -f
                         fi
                     """
-                    
+
                     // Remove the content of the target branch and replace it with the content of the temp folder
                     sh """
                         rm -rf ${WORKSPACE}/content
@@ -108,16 +117,15 @@ pipeline {
                         mkdir -p ${WORKSPACE}/content
                         cp -rT ${env.TMP_DIR}/* ${WORKSPACE}/content
                     """
-                    
+
                     // Commit the changes to the target branch
                     env.COMMIT_MESSAGE1 = "Updated ${DEPLOY_BRANCH} from ${BRANCH_NAME} at ${env.LAST_SHA}"
                     env.COMMIT_MESSAGE2 = "Built from ${BUILD_URL}"
                     sh """
-                        git status
                         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 ${DEPLOY_BRANCH}"
                 }