2018-01-31 20:44:55 -05:00
|
|
|
#!groovy
|
2018-01-31 20:46:35 -05:00
|
|
|
|
2018-11-12 11:12:15 -05:00
|
|
|
pipeline {
|
2023-01-22 20:44:31 -05:00
|
|
|
agent none
|
2019-02-21 09:45:12 -05:00
|
|
|
// save some io during the build
|
2022-07-10 21:28:34 -04:00
|
|
|
options {
|
|
|
|
skipDefaultCheckout()
|
|
|
|
durabilityHint('PERFORMANCE_OPTIMIZED')
|
2022-10-27 16:07:25 -04:00
|
|
|
buildDiscarder logRotator( numToKeepStr: '60' )
|
2023-05-14 23:21:23 -04:00
|
|
|
disableRestartFromStage()
|
2022-07-10 21:28:34 -04:00
|
|
|
}
|
2019-02-21 09:45:12 -05:00
|
|
|
stages {
|
2022-08-23 06:22:27 -04:00
|
|
|
stage("Parallel Stage") {
|
|
|
|
parallel {
|
2023-07-27 17:09:37 -04:00
|
|
|
stage("Build / Test - JDK21") {
|
2022-12-01 11:56:34 -05:00
|
|
|
agent { node { label 'linux' } }
|
|
|
|
steps {
|
|
|
|
timeout( time: 180, unit: 'MINUTES' ) {
|
|
|
|
checkout scm
|
2023-07-27 17:09:37 -04:00
|
|
|
mavenBuild( "jdk21", "clean install -Dspotbugs.skip=true -Djacoco.skip=true", "maven3")
|
2023-11-16 09:10:16 -05:00
|
|
|
recordIssues id: "jdk21", name: "Static Analysis jdk21", aggregatingResults: true, enabledForFailure: true,
|
|
|
|
tools: [mavenConsole(), java(), checkStyle(), javaDoc()],
|
2024-02-26 03:42:28 -05:00
|
|
|
skipPublishingChecks: true, skipBlames: true
|
2022-12-01 11:56:34 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-03-25 21:01:32 -04:00
|
|
|
stage("Build / Test - JDK22") {
|
|
|
|
agent { node { label 'linux' } }
|
|
|
|
steps {
|
|
|
|
timeout( time: 180, unit: 'MINUTES' ) {
|
|
|
|
checkout scm
|
|
|
|
mavenBuild( "jdk22", "clean install -Dspotbugs.skip=true -Djacoco.skip=true", "maven3")
|
|
|
|
recordIssues id: "jdk22", name: "Static Analysis jdk22", aggregatingResults: true, enabledForFailure: true, tools: [mavenConsole(), java(), checkStyle(), javaDoc()]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-08-23 06:22:27 -04:00
|
|
|
stage("Build / Test - JDK17") {
|
|
|
|
agent { node { label 'linux' } }
|
2022-07-08 05:06:04 -04:00
|
|
|
steps {
|
2022-11-01 08:07:49 -04:00
|
|
|
timeout( time: 180, unit: 'MINUTES' ) {
|
|
|
|
checkout scm
|
2023-08-21 20:46:46 -04:00
|
|
|
mavenBuild( "jdk17", "clean install -Perrorprone", "maven3") // javadoc:javadoc
|
2023-12-05 18:48:01 -05:00
|
|
|
recordIssues id: "analysis-jdk17", name: "Static Analysis jdk17", aggregatingResults: true, enabledForFailure: true,
|
2023-11-16 09:10:16 -05:00
|
|
|
tools: [mavenConsole(), java(), checkStyle(), errorProne(), spotBugs(), javaDoc()],
|
2024-02-26 03:42:28 -05:00
|
|
|
skipPublishingChecks: true, skipBlames: true
|
2023-12-05 18:48:01 -05:00
|
|
|
recordCoverage id: "coverage-jdk17", name: "Coverage jdk17", tools: [[parser: 'JACOCO']], sourceCodeRetention: 'MODIFIED',
|
|
|
|
sourceDirectories: [[path: 'src/main/java'], [path: 'target/generated-sources/ee8']]
|
2022-08-13 12:11:10 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-05-30 06:34:42 -04:00
|
|
|
}
|
|
|
|
}
|
2019-08-14 10:39:06 -04:00
|
|
|
}
|
2022-08-23 06:22:27 -04:00
|
|
|
post {
|
|
|
|
failure {
|
|
|
|
slackNotif()
|
|
|
|
}
|
|
|
|
unstable {
|
|
|
|
slackNotif()
|
|
|
|
}
|
|
|
|
fixed {
|
|
|
|
slackNotif()
|
2024-07-09 19:50:23 -04:00
|
|
|
websiteBuild()
|
|
|
|
}
|
|
|
|
success {
|
|
|
|
websiteBuild()
|
2022-08-23 06:22:27 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
def slackNotif() {
|
|
|
|
script {
|
|
|
|
try {
|
|
|
|
if ( env.BRANCH_NAME == 'jetty-10.0.x' || env.BRANCH_NAME == 'jetty-11.0.x' || env.BRANCH_NAME == 'jetty-12.0.x' ) {
|
|
|
|
//BUILD_USER = currentBuild.rawBuild.getCause(Cause.UserIdCause).getUserId()
|
|
|
|
// by ${BUILD_USER}
|
|
|
|
COLOR_MAP = ['SUCCESS': 'good', 'FAILURE': 'danger', 'UNSTABLE': 'danger', 'ABORTED': 'danger']
|
|
|
|
slackSend channel: '#jenkins',
|
|
|
|
color: COLOR_MAP[currentBuild.currentResult],
|
|
|
|
message: "*${currentBuild.currentResult}:* Job ${env.JOB_NAME} build ${env.BUILD_NUMBER} - ${env.BUILD_URL}"
|
|
|
|
}
|
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace()
|
|
|
|
echo "skip failure slack notification: " + e.getMessage()
|
|
|
|
}
|
|
|
|
}
|
2018-01-31 20:24:31 -05:00
|
|
|
}
|
2019-06-28 04:04:43 -04:00
|
|
|
|
2018-11-13 08:24:29 -05:00
|
|
|
/**
|
|
|
|
* To other developers, if you are using this method above, please use the following syntax.
|
|
|
|
*
|
|
|
|
* mavenBuild("<jdk>", "<profiles> <goals> <plugins> <properties>"
|
|
|
|
*
|
|
|
|
* @param jdk the jdk tool name (in jenkins) to use for this build
|
|
|
|
* @param cmdline the command line in "<profiles> <goals> <properties>"`format.
|
|
|
|
* @return the Jenkinsfile step representing a maven build
|
|
|
|
*/
|
2020-12-10 20:47:26 -05:00
|
|
|
def mavenBuild(jdk, cmdline, mvnName) {
|
2022-06-29 18:11:49 -04:00
|
|
|
script {
|
2020-11-18 06:26:38 -05:00
|
|
|
try {
|
|
|
|
withEnv(["JAVA_HOME=${ tool "$jdk" }",
|
|
|
|
"PATH+MAVEN=${ tool "$jdk" }/bin:${tool "$mvnName"}/bin",
|
2023-11-29 00:48:31 -05:00
|
|
|
"MAVEN_OPTS=-Xms3072m -Xmx5120m -Djava.awt.headless=true -client -XX:+UnlockDiagnosticVMOptions -XX:GCLockerRetryAllocationCount=100"]) {
|
2023-08-21 20:46:46 -04:00
|
|
|
configFileProvider(
|
|
|
|
[configFile(fileId: 'oss-settings.xml', variable: 'GLOBAL_MVN_SETTINGS'),
|
|
|
|
configFile(fileId: 'maven-build-cache-config.xml', variable: 'MVN_BUILD_CACHE_CONFIG')]) {
|
|
|
|
//sh "cp $MVN_BUILD_CACHE_CONFIG .mvn/maven-build-cache-config.xml"
|
|
|
|
//-Dmaven.build.cache.configPath=$MVN_BUILD_CACHE_CONFIG
|
|
|
|
buildCache = useBuildCache()
|
|
|
|
if (buildCache) {
|
2024-04-22 04:27:23 -04:00
|
|
|
echo "Using build cache"
|
2023-10-26 21:23:52 -04:00
|
|
|
extraArgs = " -Dmaven.build.cache.restoreGeneratedSources=false -Dmaven.build.cache.remote.url=http://nginx-cache-service.jenkins.svc.cluster.local:80 -Dmaven.build.cache.remote.enabled=true -Dmaven.build.cache.remote.save.enabled=true -Dmaven.build.cache.remote.server.id=remote-build-cache-server -Daether.connector.http.supportWebDav=true "
|
2023-08-21 20:46:46 -04:00
|
|
|
} else {
|
|
|
|
// when not using cache
|
|
|
|
echo "Not using build cache"
|
2024-04-22 04:27:23 -04:00
|
|
|
extraArgs = " -Dmaven.test.failure.ignore=true -Dmaven.build.cache.skipCache=true -Dmaven.build.cache.remote.url=http://nginx-cache-service.jenkins.svc.cluster.local:80 -Dmaven.build.cache.remote.enabled=true -Dmaven.build.cache.remote.save.enabled=true -Dmaven.build.cache.remote.server.id=remote-build-cache-server -Daether.connector.http.supportWebDav=true "
|
2023-08-21 20:46:46 -04:00
|
|
|
}
|
2023-08-29 07:48:40 -04:00
|
|
|
if (env.BRANCH_NAME ==~ /PR-\d+/) {
|
|
|
|
if (pullRequest.labels.contains("build-all-tests")) {
|
|
|
|
extraArgs = " -Dmaven.test.failure.ignore=true "
|
|
|
|
}
|
2023-08-23 21:46:13 -04:00
|
|
|
}
|
2023-08-21 20:46:46 -04:00
|
|
|
sh "mvn $extraArgs -DsettingsPath=$GLOBAL_MVN_SETTINGS -Dmaven.repo.uri=http://nexus-service.nexus.svc.cluster.local:8081/repository/maven-public/ -ntp -s $GLOBAL_MVN_SETTINGS -Dmaven.repo.local=.repository -Pci -V -B -e -U $cmdline"
|
2023-11-29 16:04:58 -05:00
|
|
|
if(saveHome()) {
|
|
|
|
archiveArtifacts artifacts: ".repository/org/eclipse/jetty/jetty-home/**/jetty-home-*", allowEmptyArchive: true, onlyIfSuccessful: false
|
|
|
|
}
|
2020-11-18 06:26:38 -05:00
|
|
|
}
|
|
|
|
}
|
2020-09-10 23:11:04 -04:00
|
|
|
}
|
|
|
|
finally
|
|
|
|
{
|
2024-06-13 18:31:46 -04:00
|
|
|
junit testResults: '**/target/surefire-reports/**/*.xml,**/target/invoker-reports/TEST*.xml', allowEmptyResults: true
|
2020-11-18 06:26:38 -05:00
|
|
|
}
|
2022-06-29 18:11:49 -04:00
|
|
|
}
|
2018-01-31 20:48:13 -05:00
|
|
|
}
|
2016-07-26 10:25:23 -04:00
|
|
|
|
2023-08-21 20:46:46 -04:00
|
|
|
/**
|
|
|
|
* calculate to use cache or not. per default will not run
|
|
|
|
*/
|
|
|
|
def useBuildCache() {
|
|
|
|
def labelNoBuildCache = false
|
|
|
|
if (env.BRANCH_NAME ==~ /PR-\d+/) {
|
|
|
|
labelNoBuildCache = pullRequest.labels.contains("build-no-cache")
|
|
|
|
}
|
|
|
|
def noBuildCache = (env.BRANCH_NAME == 'jetty-12.0.x') || labelNoBuildCache;
|
|
|
|
return !noBuildCache;
|
|
|
|
// want to skip build cache
|
|
|
|
// return false
|
|
|
|
}
|
|
|
|
|
2023-11-29 16:04:58 -05:00
|
|
|
def saveHome() {
|
|
|
|
if (env.BRANCH_NAME ==~ /PR-\d+/) {
|
|
|
|
return pullRequest.labels.contains("save-home")
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2024-07-09 19:50:23 -04:00
|
|
|
def websiteBuild() {
|
|
|
|
script {
|
|
|
|
try {
|
|
|
|
if ( env.BRANCH_NAME == 'jetty-10.0.x' || env.BRANCH_NAME == 'jetty-11.0.x' || env.BRANCH_NAME == 'jetty-12.0.x' ) {
|
|
|
|
build( job: 'website/jetty.website/main', propagate: false, wait: false )
|
|
|
|
}
|
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace()
|
|
|
|
echo "skip website build triggering: " + e.getMessage()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-11-27 19:12:07 -05:00
|
|
|
// vim: et:ts=2:sw=2:ft=groovy
|