fix(ci): serialize deployments per service

This commit is contained in:
2026-08-25 11:53:59 +08:00
parent 4fbf8bfb53
commit 322de03312
2 changed files with 36 additions and 27 deletions
@@ -71,13 +71,17 @@ test('development and test deployment locks are acquired before target executors
pipeline.indexOf("stage('部署开发或测试环境')"),
pipeline.indexOf("stage('部署单个服务')")
)
const serviceLockIndex = directDeployStage.indexOf('lock(resource: serviceDeployResource')
const lockIndex = directDeployStage.indexOf('lock(label: deploySlotLabel')
const nodeIndex = directDeployStage.indexOf('node(targetLabel)')
assert.match(directDeployStage, /agent none/)
assert.match(directDeployStage, /String targetLabel = params\.ENVIRONMENT == 'development' \? 'java-dev' : 'java-test'/)
assert.match(directDeployStage, /String serviceDeployResource = "firstleg-\$\{params\.ENVIRONMENT\}-\$\{env\.RESOLVED_SERVICE\}-deploy"/)
assert.ok(serviceLockIndex >= 0, 'per-service deployment lock must exist')
assert.ok(lockIndex >= 0, 'deployment slot lock must exist')
assert.ok(nodeIndex >= 0, 'target node allocation must exist')
assert.ok(serviceLockIndex < lockIndex, 'per-service lock must be acquired before the shared deployment slot')
assert.ok(lockIndex < nodeIndex, 'deployment lock must be acquired before target node allocation')
})