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
commit bb62c709408b37420d9ff3fb42a409f904d0f54b Author: Georg Kallidis <[email protected]> AuthorDate: Thu Dec 9 17:23:59 2021 +0100 First commit for Turbine Build --- .gitignore | 7 +++ .gitmodules | 16 +++++ Jenkinsfile | 189 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ archetypes | 1 + core | 1 + parent | 1 + pom.xml | 79 +++++++++++++++++++++++++ site | 1 + 8 files changed, 295 insertions(+) diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6751970 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +target/ +*.log +.classpath +.project +.idea/ +.settings/ +*~ \ No newline at end of file diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..90573cb --- /dev/null +++ b/.gitmodules @@ -0,0 +1,16 @@ +[submodule "site"] + path = site + url = https://gitbox.apache.org/repos/asf/turbine-site.git + branch = master +[submodule "core"] + path = core + url = https://gitbox.apache.org/repos/asf/turbine-core.git + branch = trunk +[submodule "parent"] + path = parent + url = https://gitbox.apache.org/repos/asf/turbine-parent.git + branch = master +[submodule "archetypes"] + path = archetypes + url = https://gitbox.apache.org/repos/asf/turbine-archetypes.git + branch = master diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..5ed8a06 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,189 @@ +#!groovy + +/* + * 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. + */ + +// https://ci-builds.apache.org/pipeline-syntax/globals +// https://www.jenkins.io/doc/pipeline/steps/workflow-basic-steps/ +// https://www.jenkins.io/doc/pipeline/examples/#maven-and-jdk-specific-version +// https://cwiki.apache.org/confluence/display/INFRA/Jenkins+node+labels +// https://cwiki.apache.org/confluence/display/INFRA/ASF+Cloudbees+Operations+Center + +// started with jena-site and gora + +// git-websites: +// "Nodes that are reserved for ANY project that wants to build their website docs and +// publish directly live (requires asf-site and pypubsub" +// no git-websites label her using ubuntu + +// Jenkins build server used: https://builds.apache.org/ / ci-builds.apache.org + +// Fulcurm-Build has submodules, which are expcetd for this Jenkinsfile NOT to be fetched if cloning! +// This is the default (do NOT provide git clone --recurse-submodules flag) and this is because +// only the current submodule is initialized downstrema with git submodule update --init + +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' + +pipeline + { + agent + { + 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 + { + // 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}" + } + } + } + } + stage('Build') + { + when + { + expression { params.MULTI_MODULE == 'site' } + } + steps + { + 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" + } + } + } + stage('Deploy') + { + when + { + allOf { + not { + expression + { + params.TEST_MODE + } + } + anyOf + { + expression + { + env.CURRENT_BRANCH ==~ /(?i)^(master|trunk|main).*?/ + } + } + } + } + steps + { + 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}" + + 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 + { + deleteDir() /* clean up our workspace */ + } + } + } diff --git a/archetypes b/archetypes new file mode 160000 index 0000000..bb7336f --- /dev/null +++ b/archetypes @@ -0,0 +1 @@ +Subproject commit bb7336f6848a5db063a6b87dffa872ebf5604c61 diff --git a/core b/core new file mode 160000 index 0000000..48176a6 --- /dev/null +++ b/core @@ -0,0 +1 @@ +Subproject commit 48176a65cfa544bc9003f4ac727fe46934bcb7ca diff --git a/parent b/parent new file mode 160000 index 0000000..abccb58 --- /dev/null +++ b/parent @@ -0,0 +1 @@ +Subproject commit abccb58d832cf10ba7977714ff66319050d91616 diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..0e6f133 --- /dev/null +++ b/pom.xml @@ -0,0 +1,79 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!-- + + 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 + + http://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. + +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <artifactId>turbine-parent</artifactId> + <groupId>org.apache.turbine</groupId> + <version>9</version> + </parent> + <artifactId>turbine-build</artifactId> + <packaging>pom</packaging> + <version>1</version> + <name>Turbine Master Build</name> + <url>http://turbine.apache.org/fulcrum</url> + <inceptionYear>2001</inceptionYear> + + <modules> + + <!-- turbine main endpoints --> + + <module>core</module> + <module>parent</module> + <module>site</module> + <module>archetypes</module> + + </modules> + + <scm> + <connection>scm:git:https://gitbox.apache.org/repos/asf/turbine-build.git</connection> + <developerConnection>scm:git:https://gitbox.apache.org/repos/asf/turbine-build.git</developerConnection> + <url>https://github.com/apache/turbine-build/tree/${project.scm.tag}</url> + <tag>master</tag> + </scm> + + <build> + <pluginManagement> + <plugins> + <!-- run optionally + mvn org.owasp:dependency-check-maven:aggregate + do not use it as reporting plugin, as it exposes file paths to artifacts + check each possible vulnerability carefully, find more info about how to read, false positives et al. here: https://jeremylong.github.io/DependencyCheck/dependency-check-maven/plugin-info.html + --> + <plugin> + <groupId>org.owasp</groupId> + <artifactId>dependency-check-maven</artifactId> + <executions> + <execution> + <goals> + <goal>check</goal> + </goals> + </execution> + </executions> + <!--configuration> + <suppressionFiles>true</suppressionFiles> + </configuration--> + </plugin> + </plugins> + </pluginManagement> + </build> + +</project> + diff --git a/site b/site new file mode 160000 index 0000000..28ede6f --- /dev/null +++ b/site @@ -0,0 +1 @@ +Subproject commit 28ede6fe6380e29dcabc24ce89a61b52f098a442
