Files

234 lines
6.3 KiB
Groovy
Raw Permalink Normal View History

2019-01-30 20:39:53 +01:00
#!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
*
* 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.
*/
2020-02-11 08:53:18 +01:00
2018-12-17 10:48:39 +01:00
pipeline {
agent none
2018-12-17 10:48:39 +01:00
options {
buildDiscarder logRotator(daysToKeepStr: '14', numToKeepStr: '10')
timeout(80)
2020-02-11 19:52:44 +01:00
disableConcurrentBuilds()
2020-02-12 21:00:56 +01:00
skipStagesAfterUnstable()
2020-02-11 20:02:54 +01:00
quietPeriod(30)
2018-12-17 10:48:39 +01:00
}
triggers {
pollSCM 'H/15 * * * *'
}
stages {
2020-02-13 08:48:58 +01:00
stage('Prepare') {
agent {
2020-02-13 09:05:28 +01:00
label 'ubuntu'
}
stages {
stage('Clean up') {
steps {
2020-02-13 09:06:35 +01:00
cleanWs deleteDirs: true, patterns: [[pattern: '**/target/**', type: 'INCLUDE']]
2020-02-13 09:05:28 +01:00
}
}
2020-02-13 08:48:58 +01:00
}
}
2023-11-15 09:48:44 -06:00
stage('JDK 21') {
2021-10-18 08:53:26 +02:00
agent {
label 'ubuntu'
}
tools {
2023-11-15 09:48:44 -06:00
jdk 'jdk_21_latest'
2021-10-18 08:53:26 +02:00
maven 'maven_3_latest'
}
environment {
MAVEN_OPTS = "-Xmx1024m"
}
stages {
stage('Test') {
steps {
sh './mvnw -B -DskipAssembly verify'
2021-10-18 08:53:26 +02:00
}
post {
always {
junit(testResults: '**/surefire-reports/*.xml', allowEmptyResults: true)
junit(testResults: '**/failsafe-reports/*.xml', allowEmptyResults: true)
}
}
}
}
post {
always {
cleanWs deleteDirs: true, patterns: [[pattern: '**/target/**', type: 'INCLUDE']]
}
}
2020-02-11 19:52:06 +01:00
}
2023-11-15 09:48:44 -06:00
stage('JDK 17') {
2020-02-11 19:52:06 +01:00
agent {
2020-02-13 08:04:37 +01:00
label 'ubuntu'
}
tools {
2023-11-15 09:48:44 -06:00
jdk 'jdk_17_latest'
2020-11-05 07:27:25 +01:00
maven 'maven_3_latest'
2020-02-13 08:04:37 +01:00
}
environment {
MAVEN_OPTS = "-Xmx2048m"
2020-02-11 19:52:06 +01:00
}
stages {
stage('Install') {
2020-02-11 19:52:06 +01:00
steps {
sh './mvnw -B install -DskipTests -DskipAssembly'
}
}
stage('Test') {
steps {
sh './mvnw -B verify -Pcoverage -DskipAssembly'
}
2020-02-11 19:52:06 +01:00
post {
always {
junit(testResults: '**/surefire-reports/*.xml', allowEmptyResults: true)
junit(testResults: '**/failsafe-reports/*.xml', allowEmptyResults: true)
2020-02-10 20:12:06 +01:00
}
}
2020-02-11 19:52:06 +01:00
}
stage('Build Source & JavaDoc') {
when {
anyOf {
branch 'main'
branch 'support/struts-6-x-x'
}
}
steps {
dir("local-snapshots-dir/") {
deleteDir()
}
sh './mvnw -B source:jar javadoc:jar -DskipTests -DskipAssembly'
}
}
stage('Deploy Snapshot') {
when {
anyOf {
branch 'main'
branch 'support/struts-6-x-x'
}
}
steps {
withCredentials([file(credentialsId: 'lukaszlenart-repository-access-token', variable: 'CUSTOM_SETTINGS')]) {
sh './mvnw -s \${CUSTOM_SETTINGS} deploy -DskipTests -DskipAssembly'
}
}
}
stage('Upload nightlies') {
when {
anyOf {
branch 'main'
branch 'support/struts-6-x-x'
}
}
steps {
sh './mvnw -B package -DskipTests'
sshPublisher(publishers: [
sshPublisherDesc(
2020-12-28 07:38:07 +01:00
configName: 'Nightlies',
transfers: [
sshTransfer(
2022-03-28 13:09:21 +02:00
remoteDirectory: '/struts/snapshot',
2020-12-28 08:16:10 +01:00
removePrefix: 'assembly/target/assembly/out',
sourceFiles: 'assembly/target/assembly/out/struts-*.zip'
)
],
verbose: true
)
])
}
}
}
2020-02-13 08:40:34 +01:00
post {
always {
cleanWs deleteDirs: true, patterns: [[pattern: '**/target/**', type: 'INCLUDE']]
}
}
}
2018-12-17 10:48:39 +01:00
}
2020-02-08 18:11:41 +01:00
post {
// If this build failed, send an email to the list.
failure {
script {
emailext(
to: "notifications@struts.apache.org",
2020-04-11 18:25:13 +02:00
recipientProviders: [[$class: 'DevelopersRecipientProvider']],
from: "Mr. Jenkins <jenkins@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
"""
2020-02-08 18:11:41 +01:00
)
}
}
// If this build didn't fail, but there were failing tests, send an email to the list.
unstable {
script {
emailext(
to: "notifications@struts.apache.org",
2020-04-11 18:25:13 +02:00
recipientProviders: [[$class: 'DevelopersRecipientProvider']],
from: "Mr. Jenkins <jenkins@builds.apache.org>",
subject: "Jenkins job ${env.JOB_NAME}#${env.BUILD_NUMBER} unstable",
body: """
Some tests have failed in ${env.JOB_NAME}.
Build: ${env.BUILD_URL}
Logs: ${env.BUILD_URL}console
Changes: ${env.BUILD_URL}changes
--
Mr. Jenkins
Director of Continuous Integration
"""
2020-02-08 18:11:41 +01:00
)
}
}
// Send an email, if the last build was not successful and this one is.
fixed {
script {
emailext(
to: "notifications@struts.apache.org",
2020-04-11 18:25:13 +02:00
recipientProviders: [[$class: 'DevelopersRecipientProvider']],
from: 'Mr. Jenkins <jenkins@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
"""
2020-02-08 18:11:41 +01:00
)
}
}
}
}