-
-
Notifications
You must be signed in to change notification settings - Fork 314
/
testJobTemplate
275 lines (250 loc) · 12.1 KB
/
testJobTemplate
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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
#!groovy
/*
Licensed 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
https://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.
*/
/**
* A template that defines a test job.
*/
def getBaseJDKImpl(JDK_IMPL) {
if (JDK_IMPL == "hotspot" || JDK_IMPL == "sap" || JDK_IMPL == "corretto" || JDK_IMPL == "dragonwell") {
return "hotspot"
}
return JDK_IMPL
}
if (!binding.hasVariable('JDK_IMPL')) JDK_IMPL = "openj9"
if (!binding.hasVariable('ARTIFACTORY_SERVER')) ARTIFACTORY_SERVER = ""
if (!binding.hasVariable('ARTIFACTORY_REPO')) ARTIFACTORY_REPO = ""
if (!binding.hasVariable('ARTIFACTORY_ROOT_DIR')) ARTIFACTORY_ROOT_DIR = ""
if (!binding.hasVariable('TIME_LIMIT')) TIME_LIMIT = "10"
if (!binding.hasVariable('SUFFIX')) SUFFIX = ""
if (!binding.hasVariable('JCK_GIT_REPO')) JCK_GIT_REPO = ""
if (!binding.hasVariable('JCK_GIT_REPO_PREFIX')) JCK_GIT_REPO_PREFIX = ""
if (!binding.hasVariable('SSH_AGENT_CREDENTIAL')) SSH_AGENT_CREDENTIAL = ""
if (!binding.hasVariable('KEEP_REPORTDIR')) KEEP_REPORTDIR = "true"
if (!binding.hasVariable('AUTO_DETECT')) AUTO_DETECT = true
if (!binding.hasVariable('TEST_JOB_NAME')) TEST_JOB_NAME = ""
if (!binding.hasVariable('TARGET')) TARGET = ""
if (!binding.hasVariable('BUILD_LIST')) BUILD_LIST = ""
if (!binding.hasVariable('SDK_RESOURCE')) SDK_RESOURCE = "upstream"
if (!binding.hasVariable('TRIGGER_SCHEDULE')) TRIGGER_SCHEDULE = ""
if (!binding.hasVariable('LIGHT_WEIGHT_CHECKOUT')) LIGHT_WEIGHT_CHECKOUT = false
if (!binding.hasVariable('NUM_MACHINES')) NUM_MACHINES = ""
if (!binding.hasVariable('BUILDS_TO_KEEP')) {
BUILDS_TO_KEEP = 10
} else {
BUILDS_TO_KEEP = BUILDS_TO_KEEP.toInteger()
}
if (!binding.hasVariable('DAYS_TO_KEEP')) {
DAYS_TO_KEEP = 60
} else {
DAYS_TO_KEEP = DAYS_TO_KEEP.toInteger()
}
if (binding.hasVariable('LEVELS')) {
LEVELS = LEVELS.split(',')
} else {
// 'sanity','extended','special'
LEVELS = ['sanity']
}
if (binding.hasVariable('JDK_VERSIONS')) {
JDK_VERSIONS = JDK_VERSIONS.split(',')
} else {
JDK_VERSIONS = [8]
}
if (binding.hasVariable('GROUPS')) {
GROUPS = GROUPS.split(',')
} else {
// 'functional','system','openjdk', 'perf', 'external', 'jck'
GROUPS = ['functional']
}
if (binding.hasVariable('ARCH_OS_LIST')) {
ARCH_OS_LIST = ARCH_OS_LIST.split(',')*.trim()
} else {
ARCH_OS_LIST = [
'arm_linux',
'aarch64_linux',
'ppc64_aix',
'ppc64le_linux',
's390x_linux',
's390x_zos',
'x86-32_windows',
'x86-64_linux',
'x86-64_linux_xl',
'x86-64_mac',
'x86-64_mac_xl',
'x86-64_windows'
]
}
JDK_IMPL_SN = JDK_IMPL
JDK_IMPL_BASE = getBaseJDKImpl(JDK_IMPL)
if (JDK_IMPL == "openj9") {
JDK_IMPL_SN = "j9"
} else if (JDK_IMPL == "hotspot") {
JDK_IMPL_SN = "hs"
}
// If user specifies a PARALLEL_DEFAULT option, prepend it to the list so it becomes the default in the generated job(s)
PARALLEL_LIST = ['None', 'Dynamic', 'Subdir', 'NodesByIterations']
if (binding.hasVariable('PARALLEL_DEFAULT')) {
PARALLEL_LIST.remove(PARALLEL_DEFAULT)
PARALLEL_LIST.add(0, PARALLEL_DEFAULT)
}
println "LEVELS: ${LEVELS}"
println "JDK_VERSIONS: ${JDK_VERSIONS}"
println "GROUPS: ${GROUPS}"
println "ARCH_OS_LIST: ${ARCH_OS_LIST}"
def OPENJ9_REPO = "https://github.com/eclipse/openj9.git"
def ADOPTOPENJDK_REPO = "https://github.com/AdoptOpenJDK/openjdk-tests.git"
def ADOPTOPENJDK_BRANCH = "master"
// Jenkins does not support using Repository URL and Branch build parameters with lightweight checkout together
// (See https://issues.jenkins.io/browse/JENKINS-48431)
// Set Repository URL and Branch as build parameters by default
// If LIGHT_WEIGHT_CHECKOUT is set to true, set Repository URL and Branch to its explicit value
def ADOPTOPENJDK_REPO_BUILD_PARAM = '${ADOPTOPENJDK_REPO}'
def ADOPTOPENJDK_BRANCH_BUILD_PARAM = '${ADOPTOPENJDK_BRANCH}'
def SCRIPT_PATH = "openjdk-tests/buildenv/jenkins/openjdk_tests"
LIGHT_WEIGHT_CHECKOUT = LIGHT_WEIGHT_CHECKOUT.toBoolean()
if (LIGHT_WEIGHT_CHECKOUT) {
ADOPTOPENJDK_REPO_BUILD_PARAM = ADOPTOPENJDK_REPO
ADOPTOPENJDK_BRANCH_BUILD_PARAM = ADOPTOPENJDK_BRANCH
SCRIPT_PATH = "buildenv/jenkins/openjdk_tests"
}
ARCH_OS_LIST.each { ARCH_OS ->
JDK_VERSIONS.each { JDK_VERSION ->
LEVELS.each { LEVEL ->
GROUPS.each { GROUP ->
def ACTUAL_TEST_JOB_NAME = TEST_JOB_NAME ? TEST_JOB_NAME : "Test_openjdk${JDK_VERSION}_${JDK_IMPL_SN}_${LEVEL}.${GROUP}_${ARCH_OS}${SUFFIX}"
def ACTUAL_TARGET = TARGET ? TARGET : "${LEVEL}.${GROUP}"
def ACTUAL_BUILD_LIST = BUILD_LIST ? BUILD_LIST : GROUP
// for jck builds, we need to pass in EXTRA_OPTIONS
def EXTRA_OPTIONS = "";
if (GROUP == "jck" && JDK_IMPL == "openj9") {
EXTRA_OPTIONS = "-Xfuture"
if (JDK_VERSION != "8") {
EXTRA_OPTIONS += " --enable-preview"
}
if (ARCH_OS == "s390x_zos") {
// zOS has Attach API disabled by default
EXTRA_OPTIONS += " -Dcom.ibm.tools.attach.enable=yes"
}
}
// for jck builds, if JCK_GIT_REPO_PREFIX is set, set JCK_GIT_REPO if it is not set
if (GROUP == "jck" && JCK_GIT_REPO_PREFIX && !JCK_GIT_REPO) {
JCK_GIT_REPO = "${JCK_GIT_REPO_PREFIX}/JCK${JDK_VERSION}-unzipped.git"
}
def DOCKER_REQUIRED = false
def DOCKERIMAGE_TAG = ""
def EXTRA_DOCKER_ARGS = ""
if (GROUP == "external") {
DOCKER_REQUIRED = true
DOCKERIMAGE_TAG = "nightly"
if (LEVEL == "sanity" || LEVEL == "extended") {
EXTRA_DOCKER_ARGS = '-v ${TEST_JDK_HOME}:/opt/java/openjdk'
}
}
pipelineJob("$ACTUAL_TEST_JOB_NAME") {
description('<h1>THIS IS AN AUTOMATICALLY GENERATED JOB. PLEASE DO NOT MODIFY, IT WILL BE OVERWRITTEN.</h1><p>This job is defined in testJobTemplate in the https://github.com/AdoptOpenJDK/openjdk-tests repo. If you wish to change the job, please modify testJobTemplate script.</p>')
properties {
pipelineTriggers {
triggers {
cron {
spec(TRIGGER_SCHEDULE)
}
}
}
}
definition {
parameters {
stringParam('ADOPTOPENJDK_REPO', ADOPTOPENJDK_REPO, "AdoptOpenJDK git repo. Please use ssh for zos.")
stringParam('ADOPTOPENJDK_BRANCH', ADOPTOPENJDK_BRANCH, "AdoptOpenJDK branch")
stringParam('OPENJ9_REPO', OPENJ9_REPO, "OpenJ9 git repo. Please use ssh for zos.")
stringParam('OPENJ9_BRANCH', "master", "OpenJ9 branch")
stringParam('OPENJ9_SHA', "", "OpenJ9 sha")
stringParam('JDK_REPO', "", "JDK git repo. Please use ssh for zos.")
stringParam('JDK_BRANCH', "", "JDK branch")
stringParam('JDK_VERSION', "${JDK_VERSION}", "JDK version. i.e., 8, 11")
stringParam('JDK_IMPL', JDK_IMPL_BASE, "JDK Base implementation, e.g. hotspot, openj9")
stringParam('PLATFORM', "${ARCH_OS}", "Platform to be tested")
stringParam('BUILD_LIST', "${ACTUAL_BUILD_LIST}", "Specific test directory to compile, set blank for all projects to be compiled")
stringParam('TARGET', "${ACTUAL_TARGET}", "Test TARGET to execute")
stringParam('CUSTOM_TARGET', "", "Only used when the custom target is specified in TARGET , e.g. jdk_custom, langtools_custom, etc., CUSTOM_TARGET=path to the test class to execute")
stringParam('SDK_RESOURCE', SDK_RESOURCE, "Where to get sdk? upstream, nightly, releases, or customized")
stringParam('CUSTOMIZED_SDK_URL', "", "Customized SDK url, need to set when SDK_RESOURCE=customized")
stringParam('CUSTOMIZED_SDK_URL_CREDENTIAL_ID', "", "Only use this if you are pulling an JDK from a site that needs credential")
stringParam('UPSTREAM_JOB_NAME', "", "Upstream job name from the same Jenkins server to download JDK")
stringParam('UPSTREAM_JOB_NUMBER', "", "Upstream job number from the same Jenkins server to download JDK.")
choiceParam('TEST_FLAG', ['', 'JITAAS', 'AOT'], "Optional. Only set to JITAAS/AOT for JITAAS/AOT feature testing.")
stringParam('EXTRA_OPTIONS', EXTRA_OPTIONS, "Use this to append options to the test command")
stringParam('JVM_OPTIONS', "", "Use this to replace the test original command line options")
stringParam('ITERATIONS',"1", "Number of times to repeat execution of test target")
stringParam('LABEL', "", "Jenkins node label to run on. Leave this blank for the default value specified in PLATFORM_MAP. Set to node name to run on a particular machine.")
stringParam('ACTIVE_NODE_TIMEOUT', "", "Number of minutes we will wait for a label-matching node to become active.")
stringParam('LABEL_ADDITION', "", "Additional label(s) to append to LABEL. Usually when you want to add a label to the default value.")
booleanParam('DOCKER_REQUIRED', DOCKER_REQUIRED, "Is docker required?")
stringParam('DOCKERIMAGE_TAG', DOCKERIMAGE_TAG, "Docker image tag")
stringParam('EXTRA_DOCKER_ARGS', EXTRA_DOCKER_ARGS, "Extra docker args")
stringParam('JCK_GIT_REPO', JCK_GIT_REPO, "For JCK test only")
stringParam('SSH_AGENT_CREDENTIAL', SSH_AGENT_CREDENTIAL, "Optional. Only use when ssh credentials are needed")
booleanParam('KEEP_WORKSPACE', false, "Keep workspace on the machine")
stringParam('ARTIFACTORY_SERVER', ARTIFACTORY_SERVER, "Optional. Default is to upload test output (failed build) onto artifactory only. By unset this value, test output will be archived to Jenkins")
stringParam('ARTIFACTORY_REPO', ARTIFACTORY_REPO, "Optional. It should be used with ARTIFACTORY_SERVER")
stringParam('ARTIFACTORY_ROOT_DIR', ARTIFACTORY_ROOT_DIR, "Optional. It should be used with ARTIFACTORY_SERVER and ARTIFACTORY_REPO. Default is to set root dir to be the same as the current Jenkins domain")
booleanParam('PERSONAL_BUILD', false, "Is this a personal build?")
choiceParam('PARALLEL', PARALLEL_LIST, "Optional. Parallel mode")
stringParam('NUM_MACHINES', NUM_MACHINES, "Optional. Number of machines to run in parallel. Need to be used with PARALLEL=Dynamic")
stringParam('USER_CREDENTIALS_ID', "", "Optional. User credential ID")
stringParam('VENDOR_TEST_REPOS', "", "Optional. Addtional test repos")
stringParam('VENDOR_TEST_BRANCHES', "", "Optional. Addtional test branches")
stringParam('VENDOR_TEST_SHAS', "", "Optional. Addtional test shas")
stringParam('VENDOR_TEST_DIRS', "", "Optional. Addtional test dirs")
stringParam('KEEP_REPORTDIR', KEEP_REPORTDIR, "Keep the test report dir if the test passes?")
stringParam('BUILD_IDENTIFIER', "", "build identifier")
booleanParam('AUTO_DETECT', AUTO_DETECT.toBoolean(), "Optional. Default is to enable AUTO_DETECT")
stringParam('TIME_LIMIT', TIME_LIMIT, "time limit")
stringParam('OPENJDK_SHA', "", "OpenJDK SHA from which to run tests")
stringParam('TKG_OWNER_BRANCH', "AdoptOpenJDK:master", "TestKitGen git [owner]:[branch]. Default is AdoptOpenJDK:master")
stringParam('TKG_SHA', "", "TKG sha")
stringParam('UPSTREAM_TEST_JOB_NAME', "", "Auto-populated. Upstream test job name. It will be used together with PARALLEL=Dynamic")
stringParam('UPSTREAM_TEST_JOB_NUMBER', "", "Auto-populated. Upstream test job number. It will be used together with PARALLEL=Dynamic")
booleanParam('LIGHT_WEIGHT_CHECKOUT', LIGHT_WEIGHT_CHECKOUT.toBoolean(), "Optional. Default is false for Grinders")
}
cpsScm {
scm {
git {
remote {
url(ADOPTOPENJDK_REPO_BUILD_PARAM)
}
branch(ADOPTOPENJDK_BRANCH_BUILD_PARAM)
extensions {
relativeTargetDirectory('openjdk-tests')
cleanBeforeCheckout()
pruneStaleBranch()
cloneOptions {
depth(1)
shallow(true)
timeout(60)
}
}
}
scriptPath(SCRIPT_PATH)
lightweight(LIGHT_WEIGHT_CHECKOUT)
}
}
logRotator {
numToKeep(BUILDS_TO_KEEP)
artifactNumToKeep(BUILDS_TO_KEEP)
daysToKeep(DAYS_TO_KEEP)
artifactDaysToKeep(DAYS_TO_KEEP)
}
}
}
}
}
}
}