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 2026/07/01 06:52:06 UTC
(struts-site) 03/03: ci: add declarative pipeline for the javadocs job
This is an automated email from the ASF dual-hosted git repository.
lukaszlenart pushed a commit to branch docs/jenkins-javadocs-pipeline-spec
in repository https://gitbox.apache.org/repos/asf/struts-site.git
commit 0800911aa50363f794edc665297da35c7ea028c3
Author: Lukasz Lenart <lu...@apache.org>
AuthorDate: Wed Jul 1 08:50:33 2026 +0200
ci: add declarative pipeline for the javadocs job
Converts the shell-based Struts-site-javadocs freestyle job into
Jenkinsfile.javadocs. Builds Struts with plain `mvn` and publishes the
staged Maven site into source/maven on main via the asf remote.
Co-Authored-By: Claude Opus 4.8 <no...@anthropic.com>
---
Jenkinsfile.javadocs | 113 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 113 insertions(+)
diff --git a/Jenkinsfile.javadocs b/Jenkinsfile.javadocs
new file mode 100644
index 000000000..4fc90a4f6
--- /dev/null
+++ b/Jenkinsfile.javadocs
@@ -0,0 +1,113 @@
+#!groovy
+
+pipeline {
+ agent {
+ label 'git-websites'
+ }
+ parameters {
+ string(name: 'STRUTS_TAG', defaultValue: 'main',
+ description: 'Struts release tag (e.g. STRUTS_7_2_1) or "main"')
+ }
+ options {
+ buildDiscarder logRotator(numToKeepStr: '5')
+ timeout(90)
+ disableConcurrentBuilds()
+ skipStagesAfterUnstable()
+ }
+ environment {
+ MAVEN_OPTS = '-Xmx2048m -Dhttps.protocols=TLSv1.2 -DfailOnError=false'
+ // Required: resolves `mvn` on the ASF agent (we use plain mvn, not the wrapper).
+ PATH = "${MAVEN_3_LATEST_HOME}:${env.PATH}"
+ }
+ stages {
+ stage('Build Struts & Maven site') {
+ steps {
+ sh '''
+ echo "Building Struts ${STRUTS_TAG} and staging the Maven site"
+
+ rm -rf target/struts
+ git clone https://gitbox.apache.org/repos/asf/struts.git target/struts
+
+ cd target/struts
+ if [ "${STRUTS_TAG}" = "main" ]; then
+ git checkout main
+ else
+ git checkout "tags/${STRUTS_TAG}"
+ fi
+
+ mvn -B -V clean install -DskipTests
+ mvn -B -V site:site site:stage
+ '''
+ }
+ }
+ stage('Publish to source/maven') {
+ steps {
+ sh '''
+ echo "Publishing the staged Maven site into source/maven on main"
+
+ if ! git config remote.asf.url > /dev/null; then
+ git remote add asf https://gitbox.apache.org/repos/asf/struts-site.git
+ fi
+
+ git fetch asf
+ git checkout main
+ git pull asf main
+
+ rm -rf source/maven
+ mkdir -p source/maven
+ mv target/struts/target/staging/* source/maven/
+
+ git add source/maven
+ git status
+
+ git diff --cached --quiet || git commit -m "Updates Maven site by Jenkins"
+ git push asf main
+ '''
+ }
+ }
+ }
+ post {
+ // If this build failed, send an email to the developers.
+ failure {
+ script {
+ emailext(
+ recipientProviders: [[$class: 'DevelopersRecipientProvider']],
+ from: "Mr. Jenkins <je...@builds.apache.org>",
+ subject: "Jenkins job ${env.JOB_NAME}#${env.BUILD_NUMBER} failed",
+ body: """
+There is a build failure in ${env.JOB_NAME}.
+
+Build: ${env.BUILD_URL}
+Logs: ${env.BUILD_URL}console
+Changes: ${env.BUILD_URL}changes
+
+--
+Mr. Jenkins
+Director of Continuous Integration
+"""
+ )
+ }
+ }
+ // Send an email, if the last build was not successful and this one is.
+ fixed {
+ script {
+ emailext(
+ recipientProviders: [[$class: 'DevelopersRecipientProvider']],
+ from: 'Mr. Jenkins <je...@builds.apache.org>',
+ subject: "Jenkins job ${env.JOB_NAME}#${env.BUILD_NUMBER} back to normal",
+ body: """
+The build for ${env.JOB_NAME} completed successfully and is back to normal.
+
+Build: ${env.BUILD_URL}
+Logs: ${env.BUILD_URL}console
+Changes: ${env.BUILD_URL}changes
+
+--
+Mr. Jenkins
+Director of Continuous Integration
+"""
+ )
+ }
+ }
+ }
+}