feat(fleet): add internal capacity pool and warehouse fulfillment bridge

This commit is contained in:
2026-10-07 16:46:56 +08:00
parent 564cfa107c
commit 001219460f
57 changed files with 3820 additions and 38 deletions
+30 -2
View File
@@ -628,7 +628,7 @@ foreach ($route in @(
Assert-Matches $clientOverseasRoutes $routePattern "Client 正式路由 $route"
}
# 四端统一 Gateway,保留服务与会话均来自 TEST 配置。
# 四端统一 Gateway;Compose默认TEST,生产只走Jenkins固定环境及部署白名单。
$unifiedGateway = Read-RequiredText (Join-Path $backendRoot 'gateway/src/main/resources/application.yml')
foreach ($gatewayPath in @('/api/merchant/v1/last-leg/**', '/api/platform/v1/last-leg/**', '/api/pda/v1/last-leg/**', '/api/platform/v1/warehouse-admin/**', '/api/platform/v1/overseas-warehouse-resources/**')) {
Assert-Contains $unifiedGateway $gatewayPath '统一 Gateway 路由'
@@ -638,9 +638,37 @@ Assert-Contains $unifiedGateway 'uri: lb://warehouse-overseas-service' '海外
$serviceMap = Read-RequiredText (Join-Path $backendRoot 'deploy/service-map.yml')
$testCompose = Read-RequiredText (Join-Path $backendRoot 'deploy/docker-compose.yml')
$serviceJenkinsfile = Read-RequiredText (Join-Path $backendRoot 'Jenkinsfile.service')
$dispatchJenkinsfile = Read-RequiredText (Join-Path $backendRoot 'Jenkinsfile')
$builtServiceDeploy = Read-RequiredText (Join-Path $backendRoot 'deploy/scripts/deploy-built-service.sh')
$batchServiceDeploy = Read-RequiredText (Join-Path $backendRoot 'deploy/scripts/deploy-services.sh')
Assert-Contains $testCompose 'AUTH_SESSION_VALIDATION_URL: http://auth:9100/internal/auth/accounts/sessions/validate' '统一权威会话校验'
Assert-Contains $testCompose 'REDIS_TOKEN_KEY_PREFIX' '统一会话前缀'
Assert-Contains $testCompose 'SPRING_PROFILES_ACTIVE: test' '唯一 TEST profile'
Assert-Matches $testCompose '(?m)^ SPRING_PROFILES_ACTIVE: \$\{DEPLOY_ENV:-test\}\r?$' 'Compose业务profile默认TEST'
Assert-Matches $testCompose '(?m)^ SPRING_PROFILES_ACTIVE: \$\{DEPLOY_ENV:-test\},cn\r?$' '统一Gateway默认TEST及cn路由profile'
Assert-Contains $testCompose 'name: firstleg-${DEPLOY_ENV:-test}' 'Compose项目默认TEST并按环境隔离'
Assert-Contains $builtServiceDeploy 'case "$DEPLOY_ENV" in test|production) ;; *)' '单服务部署环境白名单'
Assert-Contains $builtServiceDeploy 'Only test and production are supported' '非法部署环境拒绝'
Assert-Contains $batchServiceDeploy '[ "$1" = "test" ] || exit 2' '批量部署入口仍限TEST'
Assert-Matches $dispatchJenkinsfile '(?s)case ''backend-java'':\s*return ''test''.*?case ''backend-java-prod'':\s*return ''production''' '总控Job固定TEST及生产映射'
Assert-Contains $dispatchJenkinsfile 'if (!resolvedEnvironment || !resolvedJobPrefix)' '未知总控Job拒绝'
Assert-Contains $dispatchJenkinsfile 'params.ENVIRONMENT != resolvedEnvironment' '总控参数不得切换固定环境'
Assert-Contains $dispatchJenkinsfile "return [fixedEnvironmentForJob(jobBaseName) ?: 'test']" '总控环境选项默认TEST'
Assert-Contains $serviceJenkinsfile "if (jobBaseName?.startsWith('baiyue-firstleg-prod-')) return 'production'" '生产单服务Job固定映射'
Assert-Contains $serviceJenkinsfile "!jobBaseName.startsWith('baiyue-firstleg-dev-')" '单服务Job不接受开发环境前缀'
Assert-Contains $serviceJenkinsfile 'if (!resolvedEnvironment)' '未知单服务Job拒绝'
Assert-Contains $serviceJenkinsfile 'params.ENVIRONMENT != resolvedEnvironment' '单服务参数不得切换固定环境'
Assert-Contains $serviceJenkinsfile "return [fixedEnvironmentForServiceJob(jobBaseName) ?: 'test']" '单服务环境选项默认TEST'
foreach ($mapping in @(
@{ Text = $dispatchJenkinsfile; Function = 'fixedEnvironmentForJob'; Scope = '总控环境映射' },
@{ Text = $serviceJenkinsfile; Function = 'fixedEnvironmentForServiceJob'; Scope = '单服务环境映射' }
)) {
$bodyMatch = [regex]::Match($mapping.Text, '(?ms)^def ' + $mapping.Function + '\([^\r\n]*\)\s*\{(.*?)^\}')
Assert-Matches $bodyMatch.Value 'return ''test''' ($mapping.Scope + '默认TEST能力')
Assert-Matches $bodyMatch.Value 'return null' ($mapping.Scope + '未知Job无环境')
foreach ($returned in [regex]::Matches($bodyMatch.Value, 'return ''([^'']+)''')) {
Assert-Matches $returned.Groups[1].Value '^(test|production)$' ($mapping.Scope + '仅允许TEST及生产')
}
}
foreach ($retired in @('gateway-overseas:', 'event-bridge-service:')) {
Assert-NotContains $serviceMap $retired '部署映射'
Assert-NotContains $testCompose $retired 'TEST Compose'