ci: 收口生产 main 分支部署流程

This commit is contained in:
2026-09-17 11:49:00 +08:00
parent bf8256a817
commit cd16687d25
7 changed files with 62 additions and 36 deletions
@@ -66,9 +66,8 @@ test('service map freezes unique internal ports and moves event bridge away from
test('overseas compose is isolated from CN defaults and disables implicit schema execution', async () => {
const compose = await read('deploy/docker-compose.overseas.yml')
assert.match(compose, /^name: firstleg-\$\{DEPLOY_ENV:-test\}-overseas$/m)
assert.match(compose, /NACOS_USERNAME: \$\{NACOS_USERNAME\}/)
assert.match(compose, /NACOS_PASSWORD: \$\{NACOS_PASSWORD\}/)
assert.doesNotMatch(compose, /OVERSEAS_NACOS_(?:USERNAME|PASSWORD)/)
assert.match(compose, /NACOS_USERNAME: \$\{OVERSEAS_NACOS_USERNAME\}/)
assert.match(compose, /NACOS_PASSWORD: \$\{OVERSEAS_NACOS_PASSWORD\}/)
assert.match(compose, /NACOS_NAMESPACE: \$\{OVERSEAS_NACOS_NAMESPACE:-prod-overseas\}/)
assert.match(compose, /REGION_CODE: OVERSEAS/)
assert.match(compose, /SPRING_SQL_INIT_MODE: never/)
@@ -76,6 +76,9 @@ test('production deployments cannot skip tests', () => {
assert.match(coordinatorPipeline, /env\.RESOLVED_ENVIRONMENT == 'production' && params\.SKIP_TESTS/)
assert.match(coordinatorPipeline, /error\('生产环境禁止跳过测试'\)/)
assert.match(pipeline, /生产环境手工构建禁止跳过测试/)
assert.match(coordinatorPipeline, /refs\/heads\/main:refs\/remotes\/origin\/main/)
assert.match(coordinatorPipeline, /test "\$\(git rev-parse HEAD\)" = "\$\(git rev-parse origin\/main\)"/)
assert.match(pipeline, /git merge-base --is-ancestor "\$\{RESOLVED_SOURCE_COMMIT\}" origin\/main/)
})
test('Java builds use the shared builder pool and serialize incremental target deployments', () => {
@@ -86,7 +89,9 @@ test('Java builds use the shared builder pool and serialize incremental target d
assert.match(pipeline, /String deploySlotLabel = "firstleg-\$\{env\.RESOLVED_ENVIRONMENT\}-deploy-slot"/)
assert.match(pipeline, /lock\(label: deploySlotLabel, quantity: 1, inversePrecedence: true\)/)
assert.match(pipeline, /deploy-built-service\.sh/)
assert.doesNotMatch(pipeline, /dev_deploy|test_deploy|TARGET_SSH_KEY/)
assert.doesNotMatch(pipeline, /dev_deploy|test_deploy/)
assert.match(pipeline, /firstleg-production-ssh/)
assert.match(pipeline, /TARGET_SSH_KEY/)
assert.match(directDeployScript, /docker pull "\$IMAGE"/)
assert.match(directDeployScript, /run_ssh docker pull "\$IMAGE"/)
assert.doesNotMatch(directDeployScript, /docker save "\$IMAGE"/)
@@ -195,12 +200,12 @@ test('shared builders use a reachable public Maven mirror instead of the retired
assert.doesNotMatch(ciMavenSettings, /:18081/)
})
test('Java service images use the internal registry base image by default', () => {
const internalBaseImage = '172.31.198.7:10082/java-project/eclipse-temurin:17-jre-alpine'
test('Java service images use the canonical Gitea registry base image by default', () => {
const internalBaseImage = 'git.buggoglobal.com/java-project/eclipse-temurin:17-jre-alpine'
assert.match(coordinatorPipeline, new RegExp(internalBaseImage.replaceAll('.', '\\.')))
assert.match(pipeline, new RegExp(internalBaseImage.replaceAll('.', '\\.')))
assert.match(serviceDockerfile, new RegExp(internalBaseImage.replaceAll('.', '\\.')))
assert.match(serviceDockerfile, /ARG BASE_IMAGE/)
assert.doesNotMatch(coordinatorPipeline, /docker\.m\.daocloud\.io\/library\/eclipse-temurin/)
assert.doesNotMatch(pipeline, /docker\.m\.daocloud\.io\/library\/eclipse-temurin/)
assert.doesNotMatch(serviceDockerfile, /docker\.m\.daocloud\.io\/library\/eclipse-temurin/)