Skip to content

Commit 2d0d4e4

Browse files
author
Siyuan Feng
authored
[Unity] Enable spot nodes in CI (#16253)
CPU-SMALL nodes are unstable and often fail to build. This patch enables spot nodes in CI to reduce the cost.
1 parent f794db4 commit 2d0d4e4

File tree

1 file changed

+52
-48
lines changed

1 file changed

+52
-48
lines changed

ci/jenkins/unity_jenkinsfile.groovy

Lines changed: 52 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -135,60 +135,64 @@ def should_skip_ci(pr_number) {
135135

136136
cancel_previous_build()
137137

138-
def lint() {
139-
stage('Prepare') {
140-
node('CPU-SMALL') {
141-
// When something is provided in ci_*_param, use it, otherwise default with ci_*
142-
ci_lint = params.ci_lint_param ?: ci_lint
143-
ci_cpu = params.ci_cpu_param ?: ci_cpu
144-
ci_gpu = params.ci_gpu_param ?: ci_gpu
145-
ci_wasm = params.ci_wasm_param ?: ci_wasm
146-
ci_i386 = params.ci_i386_param ?: ci_i386
147-
ci_qemu = params.ci_qemu_param ?: ci_qemu
148-
ci_arm = params.ci_arm_param ?: ci_arm
149-
ci_hexagon = params.ci_hexagon_param ?: ci_hexagon
150-
151-
sh (script: """
152-
echo "Docker images being used in this build:"
153-
echo " ci_lint = ${ci_lint}"
154-
echo " ci_cpu = ${ci_cpu}"
155-
echo " ci_gpu = ${ci_gpu}"
156-
echo " ci_wasm = ${ci_wasm}"
157-
echo " ci_i386 = ${ci_i386}"
158-
echo " ci_qemu = ${ci_qemu}"
159-
echo " ci_arm = ${ci_arm}"
160-
echo " ci_hexagon = ${ci_hexagon}"
161-
""", label: 'Docker image names')
138+
def lint(node_type) {
139+
stage('Prepare') {
140+
node(node_type) {
141+
// When something is provided in ci_*_param, use it, otherwise default with ci_*
142+
ci_lint = params.ci_lint_param ? : ci_lint
143+
ci_cpu = params.ci_cpu_param ? : ci_cpu
144+
ci_gpu = params.ci_gpu_param ? : ci_gpu
145+
ci_wasm = params.ci_wasm_param ? : ci_wasm
146+
ci_i386 = params.ci_i386_param ? : ci_i386
147+
ci_qemu = params.ci_qemu_param ? : ci_qemu
148+
ci_arm = params.ci_arm_param ? : ci_arm
149+
ci_hexagon = params.ci_hexagon_param ? : ci_hexagon
150+
151+
sh(script: """
152+
echo "Docker images being used in this build:"
153+
echo " ci_lint = ${ci_lint}"
154+
echo " ci_cpu = ${ci_cpu}"
155+
echo " ci_gpu = ${ci_gpu}"
156+
echo " ci_wasm = ${ci_wasm}"
157+
echo " ci_i386 = ${ci_i386}"
158+
echo " ci_qemu = ${ci_qemu}"
159+
echo " ci_arm = ${ci_arm}"
160+
echo " ci_hexagon = ${ci_hexagon}"
161+
""", label: 'Docker image names')
162+
}
162163
}
163-
}
164164

165-
stage('Sanity Check') {
166-
timeout(time: max_time, unit: 'MINUTES') {
167-
node('CPU-SMALL') {
168-
ws(per_exec_ws('tvm/sanity')) {
169-
init_git()
170-
is_docs_only_build = sh (
171-
returnStatus: true,
172-
script: './tests/scripts/git_change_docs.sh',
173-
label: 'Check for docs only changes',
174-
)
175-
skip_ci = should_skip_ci(env.CHANGE_ID)
176-
skip_slow_tests = should_skip_slow_tests(env.CHANGE_ID)
177-
sh (
178-
script: "${docker_run} ${ci_lint} ./tests/scripts/task_lint.sh",
179-
label: 'Run lint',
180-
)
181-
sh (
182-
script: "${docker_run} ${ci_lint} ./tests/scripts/unity/task_extra_lint.sh",
183-
label: 'Run extra lint',
184-
)
165+
stage('Sanity Check') {
166+
timeout(time: max_time, unit: 'MINUTES') {
167+
node(node_type) {
168+
ws(per_exec_ws('tvm/sanity')) {
169+
init_git()
170+
is_docs_only_build = sh(
171+
returnStatus: true,
172+
script: './tests/scripts/git_change_docs.sh',
173+
label: 'Check for docs only changes',
174+
)
175+
skip_ci = should_skip_ci(env.CHANGE_ID)
176+
skip_slow_tests = should_skip_slow_tests(env.CHANGE_ID)
177+
sh(
178+
script: "${docker_run} ${ci_lint} ./tests/scripts/task_lint.sh",
179+
label: 'Run lint',
180+
)
181+
sh(
182+
script: "${docker_run} ${ci_lint} ./tests/scripts/unity/task_extra_lint.sh",
183+
label: 'Run extra lint',
184+
)
185+
}
185186
}
186187
}
187188
}
188189
}
189-
}
190190

191-
lint()
191+
try {
192+
lint('CPU-SMALL-SPOT')
193+
} catch (Exception ex) {
194+
lint('CPU-SMALL')
195+
}
192196

193197
// Run make. First try to do an incremental make from a previous workspace in hope to
194198
// accelerate the compilation. If something is wrong, clean the workspace and then
@@ -322,7 +326,7 @@ stage('Build and Test') {
322326
}
323327
},
324328
'BUILD: CPU': {
325-
node('CPU-SMALL') {
329+
node('CPU-SMALL-SPOT') {
326330
ws(per_exec_ws('tvm/build-cpu')) {
327331
init_git()
328332
sh "${docker_run} ${ci_cpu} ./tests/scripts/task_config_build_cpu.sh build"

0 commit comments

Comments
 (0)