fix(ci): bridge BOTH through legacy downstream choices

This commit is contained in:
2026-08-24 17:23:05 +08:00
parent ce82916036
commit 9d09b77442
5 changed files with 8 additions and 4 deletions
Vendored
+4 -1
View File
@@ -243,7 +243,10 @@ pipeline {
booleanParam(name: 'SKIP_TESTS', value: true), booleanParam(name: 'SKIP_TESTS', value: true),
string(name: 'IMAGE_REPOSITORY', value: env.RESOLVED_IMAGE_REPOSITORY), string(name: 'IMAGE_REPOSITORY', value: env.RESOLVED_IMAGE_REPOSITORY),
string(name: 'DOCKER_BASE_IMAGE', value: params.DOCKER_BASE_IMAGE), string(name: 'DOCKER_BASE_IMAGE', value: params.DOCKER_BASE_IMAGE),
string(name: 'EVENT_BRIDGE_REGION', value: params.EVENT_BRIDGE_REGION) // 旧下游 Job 的 ChoiceParameterDefinition 尚不接受 BOTH;
// 使用兼容值 SELECT 传递,下游新流水线会将其解释为双区域部署。
string(name: 'EVENT_BRIDGE_REGION', value:
params.EVENT_BRIDGE_REGION == 'BOTH' ? 'SELECT' : params.EVENT_BRIDGE_REGION)
] ]
) )
downstreamResults[service] = downstreamBuild.result ?: 'UNKNOWN' downstreamResults[service] = downstreamBuild.result ?: 'UNKNOWN'
+1 -1
View File
@@ -38,7 +38,7 @@ pipeline {
choice(name: 'ENVIRONMENT', choices: ['test', 'development', 'staging', 'production'], description: '部署环境') choice(name: 'ENVIRONMENT', choices: ['test', 'development', 'staging', 'production'], description: '部署环境')
booleanParam(name: 'DEPLOY', defaultValue: false, description: '构建成功后是否部署本服务') booleanParam(name: 'DEPLOY', defaultValue: false, description: '构建成功后是否部署本服务')
booleanParam(name: 'SKIP_TESTS', defaultValue: false, description: '是否跳过测试') booleanParam(name: 'SKIP_TESTS', defaultValue: false, description: '是否跳过测试')
choice(name: 'EVENT_BRIDGE_REGION', choices: ['BOTH', 'CN', 'OVERSEAS'], description: '仅 event-bridge-service 使用;BOTH 在开发/测试环境同时部署国内和海外实例') choice(name: 'EVENT_BRIDGE_REGION', choices: ['BOTH', 'CN', 'OVERSEAS', 'SELECT'], description: '仅 event-bridge-service 使用;BOTH 在开发/测试环境同时部署国内和海外实例;SELECT 为总控兼容值')
string(name: 'IMAGE_REPOSITORY', defaultValue: '172.31.198.7:10082/java-project/baiyue-firstleg', description: '内网共享镜像仓库基础路径,不包含服务名和标签') string(name: 'IMAGE_REPOSITORY', defaultValue: '172.31.198.7:10082/java-project/baiyue-firstleg', description: '内网共享镜像仓库基础路径,不包含服务名和标签')
string(name: 'DOCKER_BASE_IMAGE', defaultValue: '172.31.198.7:10082/java-project/eclipse-temurin:17-jre-alpine', description: '内网 Java 17 基础镜像') string(name: 'DOCKER_BASE_IMAGE', defaultValue: '172.31.198.7:10082/java-project/eclipse-temurin:17-jre-alpine', description: '内网 Java 17 基础镜像')
} }
@@ -46,4 +46,5 @@ test('coordinator defaults event bridge deployments to both non-production regio
assert.match(pipeline, /\['BOTH', 'SELECT', 'CN', 'OVERSEAS'\]\.contains\(bridgeRegion\)/) assert.match(pipeline, /\['BOTH', 'SELECT', 'CN', 'OVERSEAS'\]\.contains\(bridgeRegion\)/)
assert.match(pipeline, /兼容旧 Jenkins 参数 SELECT:本次按 BOTH/) assert.match(pipeline, /兼容旧 Jenkins 参数 SELECT:本次按 BOTH/)
assert.match(pipeline, /事件桥 BOTH 仅支持开发或测试环境/) assert.match(pipeline, /事件桥 BOTH 仅支持开发或测试环境/)
assert.match(pipeline, /params\.EVENT_BRIDGE_REGION == 'BOTH' \? 'SELECT' : params\.EVENT_BRIDGE_REGION/)
}) })
@@ -21,7 +21,7 @@ test('Jenkins pipelines recognize all overseas deployable modules', async () =>
assert.match(controller, /EVENT_BRIDGE_REGION/) assert.match(controller, /EVENT_BRIDGE_REGION/)
assert.match(service, /EVENT_BRIDGE_REGION_OVERRIDE=\$\{bridgeRegion\}/) assert.match(service, /EVENT_BRIDGE_REGION_OVERRIDE=\$\{bridgeRegion\}/)
assert.match(controller, /choices: \['BOTH', 'CN', 'OVERSEAS'\]/) assert.match(controller, /choices: \['BOTH', 'CN', 'OVERSEAS'\]/)
assert.match(service, /choices: \['BOTH', 'CN', 'OVERSEAS'\]/) assert.match(service, /choices: \['BOTH', 'CN', 'OVERSEAS', 'SELECT'\]/)
assert.match(controller, /事件桥 BOTH 仅支持开发或测试环境/) assert.match(controller, /事件桥 BOTH 仅支持开发或测试环境/)
}) })
@@ -157,7 +157,7 @@ test('direct deployments wait for health and automatically restore the previous
}) })
test('one event bridge build deploys both regional instances in development and test', () => { test('one event bridge build deploys both regional instances in development and test', () => {
assert.match(pipeline, /choice\(name: 'EVENT_BRIDGE_REGION', choices: \['BOTH', 'CN', 'OVERSEAS'\]/) assert.match(pipeline, /choice\(name: 'EVENT_BRIDGE_REGION', choices: \['BOTH', 'CN', 'OVERSEAS', 'SELECT'\]/)
assert.match(pipeline, /\['BOTH', 'SELECT'\]\.contains\(params\.EVENT_BRIDGE_REGION\)/) assert.match(pipeline, /\['BOTH', 'SELECT'\]\.contains\(params\.EVENT_BRIDGE_REGION\)/)
assert.match(pipeline, /\? \['CN', 'OVERSEAS'\]/) assert.match(pipeline, /\? \['CN', 'OVERSEAS'\]/)
assert.match(pipeline, /bridgeRegions\.each \{ bridgeRegion ->/) assert.match(pipeline, /bridgeRegions\.each \{ bridgeRegion ->/)