fix(ci): carry dual bridge intent through stable parameters
This commit is contained in:
+9
-2
@@ -76,6 +76,11 @@ pipeline {
|
||||
if (!serviceModules.contains(service)) {
|
||||
error("无法从 Job 名称 ${env.JOB_BASE_NAME} 识别服务;名称必须以以下服务之一结尾: ${serviceModules.join(', ')}")
|
||||
}
|
||||
boolean deployBothBridges = service == 'event-bridge-service'
|
||||
&& imageTag?.endsWith('-both')
|
||||
if (deployBothBridges) {
|
||||
imageTag = imageTag.substring(0, imageTag.length() - '-both'.length())
|
||||
}
|
||||
if (!sourceCommit || !(sourceCommit ==~ /(?i)[0-9a-f]{7,40}/)) {
|
||||
error('SOURCE_COMMIT 必须是 7 到 40 位十六进制 Git commit')
|
||||
}
|
||||
@@ -93,13 +98,14 @@ pipeline {
|
||||
env.RESOLVED_SOURCE_COMMIT = sourceCommit
|
||||
env.RESOLVED_IMAGE_TAG = imageTag
|
||||
env.RESOLVED_IMAGE_REPOSITORY = imageRepository
|
||||
env.DEPLOY_BOTH_EVENT_BRIDGES = deployBothBridges ? 'true' : 'false'
|
||||
|
||||
if (service == 'event-bridge-service' && params.DEPLOY) {
|
||||
String bridgeRegion = params.EVENT_BRIDGE_REGION?.trim()
|
||||
if (!['BOTH', 'SELECT', 'CN', 'OVERSEAS'].contains(bridgeRegion)) {
|
||||
error('EVENT_BRIDGE_REGION 只能为 BOTH、CN 或 OVERSEAS')
|
||||
}
|
||||
if (['BOTH', 'SELECT'].contains(bridgeRegion)
|
||||
if ((deployBothBridges || ['BOTH', 'SELECT'].contains(bridgeRegion))
|
||||
&& !['development', 'test'].contains(params.ENVIRONMENT)) {
|
||||
error('事件桥 BOTH 仅支持开发或测试环境;预发布和生产必须明确选择 CN 或 OVERSEAS')
|
||||
}
|
||||
@@ -197,7 +203,8 @@ pipeline {
|
||||
unstash 'deployment-files'
|
||||
echo "在目标节点 ${env.NODE_NAME} 本机部署到 ${params.ENVIRONMENT}"
|
||||
List bridgeRegions = env.RESOLVED_SERVICE == 'event-bridge-service'
|
||||
&& ['BOTH', 'SELECT'].contains(params.EVENT_BRIDGE_REGION)
|
||||
&& (env.DEPLOY_BOTH_EVENT_BRIDGES == 'true'
|
||||
|| ['BOTH', 'SELECT'].contains(params.EVENT_BRIDGE_REGION))
|
||||
? ['CN', 'OVERSEAS']
|
||||
: [params.EVENT_BRIDGE_REGION]
|
||||
withCredentials([
|
||||
|
||||
Reference in New Issue
Block a user