-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Expand file tree
/
Copy pathJenkinsfile
More file actions
194 lines (187 loc) · 9.09 KB
/
Jenkinsfile
File metadata and controls
194 lines (187 loc) · 9.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
/*
* 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.
*/
def MAVEN_PARAMS = "-B -e -fae -V -Dnoassembly -Dmaven.compiler.fork=true -Dsurefire.rerunFailingTestsCount=2 -Dfailsafe.rerunFailingTestsCount=1"
def MAVEN_TEST_PARAMS = env.MAVEN_TEST_PARAMS ?: "-Dci.env.name=apache.org"
def MAVEN_TEST_PARAMS_UBUNTU = env.MAVEN_TEST_PARAMS ?: "-Dci.env.name=apache.org"
/*
Below parameters are required for camel/core/camel-core module's test cases to pass on ppc64 and s390x
- xpathExprGrpLimit: limits the number of groups an Xpath expression can contain
- xpathExprOpLimit: limits the number of operators an Xpath expression can contain
The Kafka parameter is because the apache/kafka image is not working on alternative OSes
*/
def MAVEN_TEST_PARAMS_ALT_ARCHS = "-Djdk.xml.xpathExprGrpLimit=100 -Djdk.xml.xpathExprOpLimit=2000 -Dkafka.instance.type=local-strimzi-container"
pipeline {
environment {
MAVEN_SKIP_RC = true
DEVELOCITY_ACCESS_KEY = credentials('CAMEL_DEVELOCITY_ACCESS_KEY')
}
options {
buildDiscarder(
logRotator(artifactNumToKeepStr: '5', numToKeepStr: '10')
)
disableConcurrentBuilds()
throttleJobProperty(
categories: ['camel'],
throttleEnabled: true,
throttleOption: 'category'
)
// This is required if you want to clean before build
skipDefaultCheckout(true)
}
parameters {
booleanParam(name: 'VIRTUAL_THREAD', defaultValue: false, description: 'Perform the build using virtual threads')
choice(name: 'PLATFORM_FILTER', choices: ['all', 'ppc64le', 's390x', 'ubuntu-avx'], description: 'Run on specific platform')
choice(name: 'JDK_FILTER', choices: ['all', 'jdk_17_latest' ,'jdk_21_latest', 'jdk_25_latest'], description: 'Run on specific jdk')
}
agent none
stages {
stage('BuildAndTest') {
matrix {
agent {
label "${PLATFORM}"
}
options {
throttle(['camel'])
}
when { anyOf {
expression { params.PLATFORM_FILTER == 'all' }
expression { params.PLATFORM_FILTER == env.PLATFORM }
expression { params.JDK_FILTER == 'all' }
expression { params.JDK_FILTER == env.JDK_NAME }
} }
axes {
axis {
name 'JDK_NAME'
values 'jdk_17_latest', 'jdk_21_latest', 'jdk_25_latest'
}
axis {
name 'PLATFORM'
values 'ppc64le', 's390x', 'ubuntu-avx'
}
}
excludes {
exclude {
axis {
name 'JDK_NAME'
values 'jdk_21_latest'
}
axis {
name 'PLATFORM'
values 'ppc64le'
}
}
exclude {
axis {
name 'JDK_NAME'
values 'jdk_21_latest'
}
axis {
name 'PLATFORM'
values 's390x'
}
}
exclude {
axis {
name 'JDK_NAME'
values 'jdk_25_latest'
}
axis {
name 'PLATFORM'
values 'ppc64le'
}
}
exclude {
axis {
name 'JDK_NAME'
values 'jdk_25_latest'
}
axis {
name 'PLATFORM'
values 's390x'
}
}
}
tools {
jdk "${JDK_NAME}"
}
stages {
stage('Clean workspace') {
steps {
cleanWs()
sh 'rm -rvf /home/jenkins/.m2/repository/org/apache/camel'
checkout scm
}
}
stage('Build and test') {
steps {
echo "Do Build and test for ${PLATFORM}-${JDK_NAME}"
sh 'java -version'
timeout(unit: 'MINUTES', time: 450) {
script {
if ("${PLATFORM}" == "ubuntu-avx") {
if ("${JDK_NAME}" == "jdk_21_latest") {
// Enable virtual threads and coverage required later by Sonar check
sh "./mvnw $MAVEN_PARAMS $MAVEN_TEST_PARAMS_UBUNTU -Darchetype.test.skip -Dmaven.test.failure.ignore=true -Dcheckstyle.skip=true install -Dcamel.threads.virtual.enabled=${params.VIRTUAL_THREAD} -Pcoverage"
} else {
sh "./mvnw $MAVEN_PARAMS $MAVEN_TEST_PARAMS -Darchetype.test.skip -Dmaven.test.failure.ignore=true -Dcheckstyle.skip=true install"
}
} else {
// Skip the test case execution of modules which are either not supported on ppc64le or vendor images are not available for ppc64le.
sh "./mvnw $MAVEN_PARAMS $MAVEN_TEST_PARAMS $MAVEN_TEST_PARAMS_ALT_ARCHS -Darchetype.test.skip -Dmaven.test.failure.ignore=true -Dcheckstyle.skip=true install -pl '!docs'"
echo "Code quality review disabled for ${PLATFORM} with JDK ${JDK_NAME}"
}
}
}
}
post {
always {
junit allowEmptyResults: true, testResults: '**/target/surefire-reports/*.xml', skipPublishingChecks: true
junit allowEmptyResults: true, testResults: '**/target/failsafe-reports/*.xml', skipPublishingChecks: true
}
}
}
stage('Static code analysis') {
steps {
script {
echo "Do Static code analysis for ${PLATFORM}-${JDK_NAME}"
// We only execute this on the main PLATFORM/JDK target
if ("${PLATFORM}" == "ubuntu-avx" && "${JDK_NAME}" == "jdk_21_latest") {
withCredentials([string(credentialsId: 'apache-camel-core', variable: 'SONAR_TOKEN')]) {
echo "Code quality review ENABLED for ${PLATFORM} with ${JDK_NAME}"
sh "./mvnw $MAVEN_PARAMS -Dsonar.host.url=https://sonarcloud.io -Dsonar.java.experimental.batchModeSizeInKB=2048 -Dsonar.organization=apache -Dsonar.projectKey=apache_camel -Dsonar.branch.name=$BRANCH_NAME org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.coverage.exclusions=test-infra/**,tooling/**"
}
} else {
echo "Code quality review DISABLED for ${PLATFORM} with ${JDK_NAME}"
}
}
}
}
}
post {
always {
echo "Sending report CI email for developers"
emailext(
subject: '${DEFAULT_SUBJECT}',
body: '${DEFAULT_CONTENT}',
recipientProviders: [[$class: 'DevelopersRecipientProvider']]
)
}
}
}
}
}
}