You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by lu...@apache.org on 2022/04/07 06:34:56 UTC

[struts-site] branch test-build updated: Simplifies structure

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

lukaszlenart pushed a commit to branch test-build
in repository https://gitbox.apache.org/repos/asf/struts-site.git


The following commit(s) were added to refs/heads/test-build by this push:
     new 9b53fb0f9 Simplifies structure
9b53fb0f9 is described below

commit 9b53fb0f9737997cb7ad7a2d3334b99c830eeb09
Author: Lukasz Lenart <lu...@apache.org>
AuthorDate: Thu Apr 7 08:34:51 2022 +0200

    Simplifies structure
---
 Jenkinsfile | 101 +++++++++++++++++++++++++++++-------------------------------
 1 file changed, 49 insertions(+), 52 deletions(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index f5b8b8ef7..be45ce13e 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -10,61 +10,58 @@ pipeline {
     disableConcurrentBuilds()
     skipStagesAfterUnstable()
   }
+  environment {
+    RUBY_PATH="${env.WORKSPACE_TMP}/.rvm"
+    GEM_HOME="${RUBY_PATH}/gems"
+    PATH="${GEM_HOME}/bin:${env.PATH}"
+  }
   stages {
     stage('Build a staged website') {
-      environment {
-        RUBY_PATH="${env.WORKSPACE_TMP}/.rvm"
-        GEM_HOME="${RUBY_PATH}/gems"
-        PATH="${GEM_HOME}/bin:${env.PATH}"
+      steps {
+        sh """
+          echo Generiting a new version of website        
+
+          curl -sSL https://get.rvm.io | bash -s -- --path ${RUBY_PATH}
+          mkdir -p ${GEM_HOME}
+          gem install  --install-dir ${GEM_HOME} bundler -v '2.1.4'
+          
+          bundle install --path ${GEM_HOME}
+          bundle
+          bundle exec jekyll build
+        """
+      }
+    }
+    stage('Deploy') {
+      steps {
+        sh """
+          echo "Pushing changes into stage site"
+
+          if ! git config remote.asf.url > /dev/null; then
+            git remote add asf https://gitbox.apache.org/repos/asf/struts-site.git
+          fi
+
+          git checkout asf-staging
+          git pull asf asf-staging
+
+          cp -r _site/* content
+          cp -r _site/.htaccess content/.htaccess
+
+          git add content/*
+          git add content/.htaccess
+          git status
+
+          git commit -m "Updates stage by Jenkins" --allow-empty
+          git push asf asf-staging
+          git checkout master
+        """
+      }
+    }
+    stage('Comment') {
+      when {
+        changeRequest()
       }
-      stages {
-        stage('Build') {
-          steps {
-            sh """
-              echo Generiting a new version of website        
-    
-              curl -sSL https://get.rvm.io | bash -s -- --path ${RUBY_PATH}
-              mkdir -p ${GEM_HOME}
-              gem install  --install-dir ${GEM_HOME} bundler -v '2.1.4'
-              
-              bundle install --path ${GEM_HOME}
-              bundle
-              bundle exec jekyll build
-            """
-          }
-        }
-        stage('Deploy') {
-          steps {
-            sh """
-              echo "Pushing changes into stage site"
-    
-              if ! git config remote.asf.url > /dev/null; then
-                git remote add asf https://gitbox.apache.org/repos/asf/struts-site.git
-              fi
-    
-              git checkout asf-staging
-              git pull asf asf-staging
-    
-              cp -r _site/* content
-              cp -r _site/.htaccess content/.htaccess
-    
-              git add content/*
-              git add content/.htaccess
-              git status
-    
-              git commit -m "Updates stage by Jenkins" --allow-empty
-              git push asf asf-staging
-              git checkout master
-            """
-          }
-        }
-        stage('Comment') {
-          steps {
-            if (env.CHANGE_ID) {
-              pullRequest.comment("Staged site is ready at https://struts.staged.apache.org/")
-            }
-          }
-        }
+      steps {
+        pullRequest.comment("Staged site is ready at https://struts.staged.apache.org/")
       }
     }
   }