-
Notifications
You must be signed in to change notification settings - Fork 882
/
Jenkinsfile-asf
81 lines (75 loc) · 3.08 KB
/
Jenkinsfile-asf
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
#!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.
*/
pipeline {
agent {
label 'cassandra-small'
}
triggers {
// schedules only run against release branches (i.e. 3.x, 4.x, 4.5.x, etc.)
cron(branchPatternCron().matcher(env.BRANCH_NAME).matches() ? '@weekly' : '')
}
stages {
stage('Matrix') {
matrix {
axes {
axis {
name 'TEST_JAVA_VERSION'
values '[email protected]', '[email protected]', 'openjdk@17'
}
axis {
name 'SERVER_VERSION'
values '3.11',
'4.0',
'4.1',
'5.0'
}
}
stages {
stage('Tests') {
agent {
label 'cassandra-medium'
}
steps {
script {
executeTests()
junit testResults: '**/target/surefire-reports/TEST-*.xml', allowEmptyResults: true
junit testResults: '**/target/failsafe-reports/TEST-*.xml', allowEmptyResults: true
}
}
}
}
}
}
}
}
def executeTests() {
def testJavaMajorVersion = (TEST_JAVA_VERSION =~ /@(?:1\.)?(\d+)/)[0][1]
sh """
container_id=\$(docker run -td -e TEST_JAVA_VERSION=${TEST_JAVA_VERSION} -e SERVER_VERSION=${SERVER_VERSION} -e TEST_JAVA_MAJOR_VERSION=${testJavaMajorVersion} -v \$(pwd):/home/docker/cassandra-java-driver apache.jfrog.io/cassan-docker/apache/cassandra-java-driver-testing-ubuntu2204 'sleep 2h')
docker exec --user root \$container_id bash -c \"sudo bash /home/docker/cassandra-java-driver/ci/create-user.sh docker \$(id -u) \$(id -g) /home/docker/cassandra-java-driver\"
docker exec --user docker \$container_id './cassandra-java-driver/ci/run-tests.sh'
( nohup docker stop \$container_id >/dev/null 2>/dev/null & )
"""
}
// branch pattern for cron
// should match 3.x, 4.x, 4.5.x, etc
def branchPatternCron() {
~'((\\d+(\\.[\\dx]+)+))'
}