You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@turbine.apache.org by gk...@apache.org on 2022/01/19 12:58:03 UTC

[turbine-fulcrum-build] branch master updated: update build, use subfolder in Jenkinsfile

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

gk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/turbine-fulcrum-build.git


The following commit(s) were added to refs/heads/master by this push:
     new b09acc8  update build, use subfolder in Jenkinsfile
b09acc8 is described below

commit b09acc8ab8c385be9407fb623c28e3cff743c10a
Author: Georg Kallidis <gk...@apache.org>
AuthorDate: Wed Jan 19 13:57:18 2022 +0100

    update build, use subfolder in Jenkinsfile
---
 Jenkinsfile | 306 ++++++++++++++++++++++++++++++++----------------------------
 crypto      |   2 +-
 yaafi       |   2 +-
 3 files changed, 164 insertions(+), 146 deletions(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index 762226a..236f55b 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#!groovy
+
 def AGENT_LABEL = env.AGENT_LABEL ?: 'ubuntu'
 def JDK_NAME = env.JDK_NAME ?: 'jdk_1.8_latest'
 def MVN_NAME = env.MVN_NAME ?: 'maven_3_latest'
@@ -5,174 +23,174 @@ def MVN_NAME = env.MVN_NAME ?: 'maven_3_latest'
 pipeline
     {
         agent
-             {
-                label AGENT_LABEL
-            }
+        {
+             node {
+                 label AGENT_LABEL
+             }
+        }
         parameters
-            {
-                //string(name: 'MULTI_MODULE', defaultValue: 'staging', description: '')
-                choice(name: 'MULTI_MODULE', choices: ['staging', 'site'], description: 'Run as multi or single module ')
-                // no default
-                choice(name: 'FULCRUM_COMPONENT', choices: ['','cache', 'crypto', 'factory', 'intake', 'json', 'localization', 'parser', 'pool', 'quartz', 'security', 'site', 'testcontainer', 'upload', 'yaafi', 'yaafi-crypto'], description: 'Select fulcrum component')
-                // default master
-                choice(name: 'SUB_MODULE_HEAD', choices: ['master', 'main','trunk'], description: 'The master/main/trunk branch of the Fulcrum component')
-                booleanParam(name: 'TEST_MODE', defaultValue: true, description: 'Run as Test Build or Deploy site for Component ')
-            }
+        {
+            //string(name: 'MULTI_MODULE', defaultValue: 'staging', description: '')
+            choice(name: 'MULTI_MODULE', choices: ['staging', 'site'], description: 'Run as multi or single module ')
+            // no default
+            choice(name: 'FULCRUM_COMPONENT', choices: ['','cache', 'crypto', 'factory', 'intake', 'json', 'localization', 'parser', 'pool', 'quartz', 'security', 'site', 'testcontainer', 'upload', 'yaafi', 'yaafi-crypto'], description: 'Select fulcrum component')
+            // default master
+            choice(name: 'SUB_MODULE_HEAD', choices: ['master', 'main','trunk'], description: 'The master/main/trunk branch of the Fulcrum component')
+            booleanParam(name: 'TEST_MODE', defaultValue: true, description: 'Run as Test Build or Deploy site for Component ')
+        }
         tools
-            {
-                maven MVN_NAME
-                jdk JDK_NAME
-            }
+        {
+            maven MVN_NAME
+            jdk JDK_NAME
+        }
         environment
-            {
-                DEPLOY_BRANCH = 'asf-site'
-                STAGING_DIR = "target/${params.MULTI_MODULE}"
-                // LANG = 'C.UTF-8'
-                // -B, --batch-mode Run in non-interactive (batch) mode
-                // -e, --error Produce execution error messages
-                // -fae, --fail-at-end Only fail the build afterwards; allow all non-impacted builds to continue
-                // -U,--update-snapshots                  Forces a check for missing
-                // -V, --show-version Display version information WITHOUT stopping build
-                // -ntp, --no-transfer-progress Do not display transfer progress when downloading or uploading
-                // surefire.useFile  Option to generate a file test report or just output the test report to the console. Default true
-                MAVEN_CLI_OPTS = "-B -V -U -e -fae -ntp -Dsurefire.useFile=false"
-                MAVEN_GOALS = "${params.MULTI_MODULE == 'site' ? 'clean site' : 'clean site site:stage'}"
-            }
+        {
+            DEPLOY_BRANCH = 'asf-site'
+            STAGING_DIR = "target/${params.MULTI_MODULE}"
+            // LANG = 'C.UTF-8'
+            // -B, --batch-mode Run in non-interactive (batch) mode
+            // -e, --error Produce execution error messages
+            // -fae, --fail-at-end Only fail the build afterwards; allow all non-impacted builds to continue
+            // -U,--update-snapshots                  Forces a check for missing
+            // -V, --show-version Display version information WITHOUT stopping build
+            // -ntp, --no-transfer-progress Do not display transfer progress when downloading or uploading
+            // surefire.useFile  Option to generate a file test report or just output the test report to the console. Default true
+            MAVEN_CLI_OPTS = "-B -V -U -e -fae -ntp -Dsurefire.useFile=false"
+            MAVEN_GOALS = "${params.MULTI_MODULE == 'site' ? 'clean site' : 'clean site site:stage'}"
+        }
         stages
-            {
+        {
             stage('Prepare')
+            {
+                steps
                 {
-                    steps
+                    dir("${params.FULCRUM_COMPONENT}")
+                    {
+                        git "https://gitbox.apache.org/repos/asf/turbine-fulcrum-${params.FULCRUM_COMPONENT}.git"
+                        script
                         {
-                            git 'https://gitbox.apache.org/repos/asf/turbine-fulcrum-build.git'
-                            // not --update as clone ise done without --recurse-submodules
-                            sh "git submodule update --init ${params.FULCRUM_COMPONENT}"
-                            // branch will be detached head, need to checkout explicitely
-                            dir("${params.FULCRUM_COMPONENT}")
-                                {
-                                    script
-                                        {
-                                            sh "pwd"
-                                            sh "git branch"
-                                            echo "${params.FULCRUM_COMPONENT}: Checking out ${params.SUB_MODULE_HEAD}"
-                                            sh "git checkout ${params.SUB_MODULE_HEAD}"
-                                            env.CURRENT_BRANCH = sh(script: "git status --branch --porcelain | grep '##' | cut -c 4-", returnStdout: true).trim()
-                                            echo "CURRENT_BRANCH: ${env.CURRENT_BRANCH}"
-                                            // Capture last commit hash for final commit message
-                                            env.LAST_SHA = sh(script: 'git log -n 1 --pretty=format:%H', returnStdout: true).trim()
-                                            echo "LAST_SHA: ${env.LAST_SHA}"
-                                        }
-                                }
+                            sh "pwd"
+                            sh "git branch"
+                            echo "${params.FULCRUM_COMPONENT}: Checking out ${params.SUB_MODULE_HEAD}"
+                            env.CURRENT_BRANCH = sh(script: "git status --branch --porcelain | grep '##' | cut -c 4-", returnStdout: true).trim()
+                            echo "CURRENT_BRANCH: ${env.CURRENT_BRANCH}"
+                            // Capture last commit hash for final commit message
+                            env.LAST_SHA = sh(script: 'git log -n 1 --pretty=format:%H', returnStdout: true).trim()
+                            echo "LAST_SHA: ${env.LAST_SHA}"
                         }
+                    }
                 }
+            }
             stage('Build')
+            {
+                when
                 {
-                    when
-                        {
-                        expression { params.MULTI_MODULE == 'site' }
+                    expression { params.MULTI_MODULE == 'site' }
+                }
+                steps
+                {
+                    dir("${params.FULCRUM_COMPONENT}")
+                    {
+                        sh "pwd"
+                        // builds into target/site folder, this folder is expected to be preserved as it is used in next step
+                        sh "mvn $MAVEN_CLI_OPTS $MAVEN_GOALS"
+                        stash includes: "${STAGING_DIR}/**/*", name: "${params.FULCRUM_COMPONENT}-site"
                     }
-                    steps
-                        {
-                            dir("${params.FULCRUM_COMPONENT}")
-                                {
-                                    sh "pwd"
-                                    // builds into target/site folder, this folder is expected to be preserved as it is used in next step
-                                    sh "mvn $MAVEN_CLI_OPTS $MAVEN_GOALS"
-                                    stash includes: "${STAGING_DIR}/**/*", name: "${params.FULCRUM_COMPONENT}-site"
-                                }
-                        }
                 }
+            }
             stage('BuildWithStage')
+            {
+                when
                 {
-                    when
-                        {
-                            expression
-                                {
-                                params.MULTI_MODULE == 'staging'
-                            }
-                        }
-                    steps
+                    expression
+                    {
+                        params.MULTI_MODULE == 'staging'
+                    }
+                }
+                steps
+                {
+                    dir("${params.FULCRUM_COMPONENT}")
+                    {
+                        sh "pwd"
+                        // builds into target/staging folder, this folder is expected to be preserved as it is used in next step
+                        sh "mvn $MAVEN_CLI_OPTS $MAVEN_GOALS"
+                        stash includes: "${STAGING_DIR}/**/*", name: "${params.FULCRUM_COMPONENT}-site"
+                    }
+                }
+            }
+            stage('Deploy Site')
+            {
+                when
+                {
+                   anyOf
+                    {
+                        expression
                         {
-                            dir("${params.FULCRUM_COMPONENT}")
-                                {
-                                    sh "pwd"
-                                    // builds into target/staging folder, this folder is expected to be preserved as it is used in next step
-                                    sh "mvn $MAVEN_CLI_OPTS $MAVEN_GOALS"
-                                    stash includes: "${STAGING_DIR}/**/*", name: "${params.FULCRUM_COMPONENT}-site"
-                                }
+                            env.CURRENT_BRANCH ==~ /(?i)^(master|trunk|main).*?/
                         }
+                    }
                 }
-            stage('Deploy Site')
+                agent {
+                    node {
+                        label 'git-websites'
+                    }
+                }
+                steps
                 {
-                    when
+                    dir("${params.FULCRUM_COMPONENT}")
+                    {
+                        sh "pwd"
+                        echo "Deploying ${params.FULCRUM_COMPONENT} Site"
+                        sh "ls"
+                        git "https://gitbox.apache.org/repos/asf/turbine-fulcrum-${params.FULCRUM_COMPONENT}.git"
+                        dir("${STAGING_DIR}") {
+                            deleteDir()
+                        }
+                        sh "pwd"
+                        // fetch only shallow
+                        // sh "git pull --depth=2 origin ${DEPLOY_BRANCH}"
+                        unstash "${params.FULCRUM_COMPONENT}-site"
+                        sh "ls"
+                        sh "git branch -a"
+                        // Checkout branch with current site content, target folder should be ignored!
+                        sh "git checkout ${DEPLOY_BRANCH}"
+                        script
                         {
-                           anyOf
+                            echo "TEST_MODE: ${params.TEST_MODE}"
+                            def exists = fileExists '.gitignore'
+                            if (exists)
                             {
-                                expression
-                                    {
-                                        env.CURRENT_BRANCH ==~ /(?i)^(master|trunk|main).*?/
-                                    }
+                                echo "Fulcrum component ${params.FULCRUM_COMPONENT}: .gitignore exists in branch ${DEPLOY_BRANCH}."
+                            } else {
+                                echo "Fulcrum component ${params.FULCRUM_COMPONENT}: creating default .gitignore in branch ${DEPLOY_BRANCH}."
+                                sh "echo 'target/' > .gitignore"
+                                sh "git add .gitignore"
+                                sh "git commit -m \"Added .gitignore\""
+                            }
+                            // Remove the content (files) of the root folder and subdirectories and replace it with the content of the STAGING_DIR folder
+                            sh """
+    git ls-files | grep -v "^\\." | xargs  rm -f
+    """
+                            sh "cp -rf ./${STAGING_DIR}/* ."
+                            // Commit the changes to the target branch BRANCH_NAME, groovy allows to omit env. prefix, available in multibranch pipeline.
+                            env.COMMIT_MESSAGE = "${params.FULCRUM_COMPONENT}: Updating site in ${DEPLOY_BRANCH} from ${env.CURRENT_BRANCH} (${env.LAST_SHA}) from ${params.MULTI_MODULE} from ${BUILD_URL}"
+                            echo "${env.COMMIT_MESSAGE}"
+                            if ( params.TEST_MODE.toBoolean() == false) 
+                            {
+                                echo "committing ..."
+                                sh "git add -A"
+                                sh "git commit -m \"${env.COMMIT_MESSAGE}\" | true"
+                                // Push the generated content for deployment
+                                sh "git push -u origin ${DEPLOY_BRANCH}"
+                            } else {
+                                echo 'Skipping as test mode is set ...'
                             }
-                    }
-                    agent {
-                        node {
-                            label 'git-websites'
                         }
-                    }
-                    steps
-                        {
-                            sh "git submodule update --init ${params.FULCRUM_COMPONENT}"
-                            dir("${params.FULCRUM_COMPONENT}")
-                                {
-                                    script
-                                        {
-                                            sh "pwd"
-                                            echo "Deploying ${params.FULCRUM_COMPONENT} Site"
-                                            unstash "${params.FULCRUM_COMPONENT}-site"
-                                            // Checkout branch with current site content, target folder should be ignored!
-                                            sh "git checkout ${DEPLOY_BRANCH}"
-                                            // fetch only shallow
-                                            // sh "git pull --depth=2 origin ${DEPLOY_BRANCH}"
-
-                                            def exists = fileExists '.gitignore'
-                                            if (exists)
-                                            {
-                                                echo "Fulcrum component ${params.FULCRUM_COMPONENT}: .gitignore exists in branch ${DEPLOY_BRANCH}."
-                                            } else {
-                                                echo "Fulcrum component ${params.FULCRUM_COMPONENT}: creating default .gitignore in branch ${DEPLOY_BRANCH}."
-                                                sh "echo 'target/' > .gitignore"
-                                                sh "git add .gitignore"
-                                                sh "git commit -m \"Added .gitignore\""
-                                            }
-                                            // Remove the content (files) of the root folder and subdirectories and replace it with the content of the STAGING_DIR folder
-                                            sh """
-git ls-files | grep -v "^\\." | xargs  rm -f
-"""
-                                            sh "cp -rf ./${STAGING_DIR}/* ."
-                                            // Commit the changes to the target branch BRANCH_NAME, groovy allows to omit env. prefix, available in multibranch pipeline.
-                                            env.COMMIT_MESSAGE = "${params.FULCRUM_COMPONENT}: Updated site in ${DEPLOY_BRANCH} from ${env.CURRENT_BRANCH} (${env.LAST_SHA}) from ${params.MULTI_MODULE} from ${BUILD_URL}"
-                                            echo "${env.COMMIT_MESSAGE} ....break...."
-                                            
-                                            if ( params.TEST_MODE == false) {
-                                                echo 'committing as test mode false'
-                                                //sh "git add -A"
-                                                //sh "git commit -m "${env.COMMIT_MESSAGE}" | true"
-                                                // Push the generated content for deployment
-                                                //sh "git push -u origin ${DEPLOY_BRANCH}"
-                                            } else {
-                                                echo 'Skipping as test mode'
-                                            }
-                                            
-                                        }
-                                }
+                        dir("${STAGING_DIR}") {
+                            deleteDir()
                         }
-                }
-        }
-        post
-            {
-                always
-                    {
-                        deleteDir() /* clean up our workspace */
                     }
+                }
             }
+        }
     }
diff --git a/crypto b/crypto
index 9fbdd91..1fdae12 160000
--- a/crypto
+++ b/crypto
@@ -1 +1 @@
-Subproject commit 9fbdd910bf080f9565b243f1fac4d50f07ee4b7c
+Subproject commit 1fdae122744274c1d051746fe1024856dcb6cd91
diff --git a/yaafi b/yaafi
index e63808d..448c6f4 160000
--- a/yaafi
+++ b/yaafi
@@ -1 +1 @@
-Subproject commit e63808dc8ca2540618e589c1cdeff8d58c6d24d6
+Subproject commit 448c6f4482876382213ab46c7f81dcb1e79879b4