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-build.git
The following commit(s) were added to refs/heads/master by this push:
new 982e3b3 Update Jenkinsfile based on tested pipeline in Groovy sandbox
(ci-builds.apache.org Turbine Fulcrum build Site Pipeline), update parent to
11, add updated submodules
new 2f439d6 Merge branch 'master' of
https://gitbox.apache.org/repos/asf/turbine-build
982e3b3 is described below
commit 982e3b30bdd4bd5a41587bc42e3445d3758ece8b
Author: Georg Kallidis <[email protected]>
AuthorDate: Wed Jan 19 13:23:08 2022 +0100
Update Jenkinsfile based on tested pipeline in Groovy sandbox
(ci-builds.apache.org Turbine Fulcrum build Site Pipeline), update parent to
11, add updated submodules
---
Jenkinsfile | 267 +++++++++++++++++++++++++++++++-----------------------------
archetypes | 2 +-
core | 2 +-
parent | 2 +-
pom.xml | 2 +-
site | 2 +-
6 files changed, 141 insertions(+), 136 deletions(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index bfbd624..a8f097e 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -46,155 +46,160 @@ def JDK_NAME = env.JDK_NAME ?: 'jdk_1.8_latest'
def MVN_NAME = env.MVN_NAME ?: 'maven_3_latest'
pipeline
+ {
+ agent
{
- agent
- {
- node {
- label AGENT_LABEL
- }
- }
- parameters
+ node {
+ label AGENT_LABEL
+ }
+ }
+ parameters
+ {
+ string(name: 'MULTI_MODULE', defaultValue: 'site', description: 'Run
as site module (')
+ // no default
+ choice(name: 'TURBINE_COMPONENT', choices: ['','core', 'parent',
'site', 'archetypes'], description: 'Select Turbine component')
+ // default master
+ choice(name: 'SUB_MODULE_HEAD', choices: ['master', 'main','trunk'],
description: 'The master/main/trunk branch of the Turbine component')
+ booleanParam(name: 'TEST_MODE', defaultValue: true, description: 'Run
as Test Build or Deploy site for Component ')
+ }
+ tools
+ {
+ 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'}"
+ }
+ stages
+ {
+ stage('Prepare')
+ {
+ steps
{
- string(name: 'MULTI_MODULE', defaultValue: 'site',
description: 'Run as site module (')
- // no default
- choice(name: 'TURBINE_COMPONENT', choices: ['','core',
'parent', 'site', 'archetypes'], description: 'Select Turbine component')
- // default master
- choice(name: 'SUB_MODULE_HEAD', choices: ['master',
'main','trunk'], description: 'The master/main/trunk branch of the Turbine
component')
- booleanParam(name: 'TEST_MODE', defaultValue: true,
description: 'Run as Test Build or Deploy site for Component ')
+ git
"https://gitbox.apache.org/repos/asf/turbine-${params.TURBINE_COMPONENT}.git"
+ script
+ {
+ sh "pwd"
+ sh "git branch"
+ echo "${params.TURBINE_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}"
+ }
}
- tools
+ }
+ stage('Build')
+ {
+ when
{
- maven MVN_NAME
- jdk JDK_NAME
+ expression { params.MULTI_MODULE == 'site' }
}
- environment
+ steps
{
- 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'}"
+ dir("${params.TURBINE_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"
+ // save as pipeline stash, thanks to
https://cwiki.apache.org/confluence/display/INFRA/Multibranch+Pipeline+recipes
+ //
https://docs.cloudbees.com/docs/admin-resources/latest/automating-with-jenkinsfile/using-multiple-agents
+ stash includes: "${STAGING_DIR}/**/*", name:
"${params.TURBINE_COMPONENT}-site"
+ }
}
- stages
+ }
+ stage('Deploy Site')
+ {
+ when
{
- stage('Prepare')
+ allOf
{
- steps
- {
- // not --update as clone ise done without
--recurse-submodules
- sh "git submodule update --init
${params.TURBINE_COMPONENT}"
- // branch will be detached head, need to checkout
explicitely
- dir("${params.TURBINE_COMPONENT}")
- {
- script
- {
- sh "pwd"
- sh "git branch"
- echo "${params.TURBINE_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}"
- }
- }
+ not
+ {
+ expression
+ {
+ params.TEST_MODE
}
- }
- stage('Build')
- {
- when
- {
- expression { params.MULTI_MODULE == 'site' }
}
- steps
+ anyOf
+ {
+ expression
{
- dir("${params.TURBINE_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"
- }
+ env.CURRENT_BRANCH ==~
/(?i)^(master|trunk|main).*?/
}
+ }
}
- stage('Deploy Site')
+ }
+ // Only the nodes labeled 'git-websites' have the credentials to
commit to the.
+ agent
+ {
+ node
{
- when
- {
- allOf {
- not {
- expression
- {
- params.TEST_MODE
- }
- }
- anyOf
- {
- expression
- {
- env.CURRENT_BRANCH ==~
/(?i)^(master|trunk|main).*?/
- }
- }
- }
- }
- // Only the nodes labeled 'git-websites' have the
credentials to commit to the.
- agent {
- node {
- label 'git-websites'
- }
- }
- steps
- {
- echo 'Deploying ${params.TURBINE_COMPONENT} Site'
- dir("${params.TURBINE_COMPONENT}")
- {
- script
- {
- sh "pwd"
- // 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}"
+ label 'git-websites'
+ }
+ }
+ steps
+ {
+ echo "Deploying ${params.TURBINE_COMPONENT} Site"
+ //sh "git submodule update --init ${params.TURBINE_COMPONENT}"
+ git
"https://gitbox.apache.org/repos/asf/turbine-${params.TURBINE_COMPONENT}.git"
+ dir("${STAGING_DIR}") {
+ deleteDir()
+ }
+ script
+ {
+ sh "pwd"
+ unstash "${params.TURBINE_COMPONENT}-site"
+ // Checkout branch with current site content, target
folder should be ignored!
+ sh "git checkout ${DEPLOY_BRANCH}"
+ // fetch already in checkout
- def exists = fileExists
'.gitignore'
- if (exists)
- {
- echo "Turbine component
${params.TURBINE_COMPONENT}: .gitignore exists in branch ${DEPLOY_BRANCH}."
- } else {
- echo "Turbine component
${params.TURBINE_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 """
+ def exists = fileExists '.gitignore'
+ if (exists)
+ {
+ echo "Turbine component ${params.TURBINE_COMPONENT}:
.gitignore exists in branch ${DEPLOY_BRANCH}."
+ } else {
+ echo "Turbine component ${params.TURBINE_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.TURBINE_COMPONENT}: Updated site in ${DEPLOY_BRANCH} from
${env.CURRENT_BRANCH} (${env.LAST_SHA}) from ${params.MULTI_MODULE} from
${BUILD_URL}"
- sh "git add -A"
- sh "git commit -m
"${env.COMMIT_MESSAGE}" | true"
- echo "${env.COMMIT_MESSAGE}"
- // Push the generated content for
deployment
- sh "git push -u origin
${DEPLOY_BRANCH}"
- }
- }
- }
- }
- }
- post
- {
- always
+ 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.TURBINE_COMPONENT}: Updated
site in ${DEPLOY_BRANCH} from ${env.CURRENT_BRANCH} (${env.LAST_SHA}) from
${params.MULTI_MODULE} from ${BUILD_URL}"
+ if ( params.TEST_MODE.toBoolean() == false)
{
- deleteDir() /* clean up our workspace */
+ 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 ...'
}
- }
+ }
+ dir("${STAGING_DIR}") {
+ deleteDir()
+ }
+ }
+ }
}
+}
diff --git a/archetypes b/archetypes
index b2afb56..f5ffe39 160000
--- a/archetypes
+++ b/archetypes
@@ -1 +1 @@
-Subproject commit b2afb5673569a1aa8bac692b5baea4a7303a5a81
+Subproject commit f5ffe390cda7df86a97ee97b822b4123bd9ccfff
diff --git a/core b/core
index b295f2b..28e9ba2 160000
--- a/core
+++ b/core
@@ -1 +1 @@
-Subproject commit b295f2bb661dc18e5e8899be7dd60122a44a0d86
+Subproject commit 28e9ba276b87849e6ffcb143c5a5356a9e269675
diff --git a/parent b/parent
index 6ff3eaf..746df43 160000
--- a/parent
+++ b/parent
@@ -1 +1 @@
-Subproject commit 6ff3eaff7796e17ada95bd0618d2ea0076ef3bf1
+Subproject commit 746df430eb96a39aa7c63404005005e17b7194df
diff --git a/pom.xml b/pom.xml
index 0e6f133..031cc5f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@
<parent>
<artifactId>turbine-parent</artifactId>
<groupId>org.apache.turbine</groupId>
- <version>9</version>
+ <version>11</version>
</parent>
<artifactId>turbine-build</artifactId>
<packaging>pom</packaging>
diff --git a/site b/site
index 8f43b49..4afeddb 160000
--- a/site
+++ b/site
@@ -1 +1 @@
-Subproject commit 8f43b499481ac5b60402fc312fcc9f39d7bae4bb
+Subproject commit 4afeddb57fe77c539ffe60ae866f6ca41a1d918f