Skip to content

Commit 8849097

Browse files
committed
feat(jenkins): 添加测试阶段执行参数控制
- 在 Jenkinsfile 中新增 RUN_TESTS 参数用于控制测试阶段执行 - 通过 when 条件判断实现测试阶段的可选执行 - 默认设置为跳过测试阶段以加快构建速度 - 保留原有的 pip 缓存挂载配置
1 parent b2a4e29 commit 8849097

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

Jenkinsfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ pipeline {
77
buildDiscarder(logRotator(numToKeepStr: '20'))
88
}
99

10+
parameters {
11+
booleanParam(name: 'RUN_TESTS', defaultValue: false, description: '是否执行 Test 阶段;默认跳过以加快构建')
12+
}
13+
1014
environment {
1115
IMAGE = 'tolink-rag'
1216
TAG = "${env.GIT_COMMIT?.take(8) ?: env.BUILD_NUMBER}"
@@ -19,6 +23,9 @@ pipeline {
1923
}
2024

2125
stage('Test') {
26+
when {
27+
expression { return params.RUN_TESTS }
28+
}
2229
agent {
2330
// 挂载 pip 缓存到 jenkins_home,跨构建复用已下载的包
2431
docker { image 'python:3.11-slim'; args '-v $HOME/.cache/pip:/root/.cache/pip'; reuseNode true }

0 commit comments

Comments
 (0)