perf(ci): allow two concurrent non-production deploys

This commit is contained in:
2026-08-24 11:17:17 +08:00
parent 9198ce02d9
commit fe4eb0b593
3 changed files with 12 additions and 10 deletions
@@ -39,13 +39,15 @@ test('Java builds use the shared builder pool and serialize incremental target d
assert.match(pipeline, /\['development', 'test'\]\.contains\(params\.ENVIRONMENT\)/)
assert.match(pipeline, /params\.ENVIRONMENT == 'development' \? 'java-dev' : 'java-test'/)
assert.match(pipeline, /'TARGET_IS_LOCAL=true'/)
assert.match(pipeline, /String deployLock = "firstleg-\$\{params\.ENVIRONMENT\}-deploy"/)
assert.match(pipeline, /lock\(resource: deployLock, inversePrecedence: true\)/)
assert.match(pipeline, /String deploySlotLabel = "firstleg-\$\{params\.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.match(directDeployScript, /docker pull "\$IMAGE"/)
assert.match(directDeployScript, /run_ssh docker pull "\$IMAGE"/)
assert.doesNotMatch(directDeployScript, /docker save "\$IMAGE"/)
assert.match(directDeployScript, /up -d --no-deps --pull never/)
assert.doesNotMatch(directDeployScript, /--remove-orphans/)
assert.match(directDeployScript, /--pull never/)
})
@@ -54,12 +56,12 @@ test('development and test deployment locks are acquired before target executors
pipeline.indexOf("stage('部署开发或测试环境')"),
pipeline.indexOf("stage('部署单个服务')")
)
const lockIndex = directDeployStage.indexOf('lock(resource: deployLock')
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.ok(lockIndex >= 0, 'deployment lock must exist')
assert.ok(lockIndex >= 0, 'deployment slot lock must exist')
assert.ok(nodeIndex >= 0, 'target node allocation must exist')
assert.ok(lockIndex < nodeIndex, 'deployment lock must be acquired before target node allocation')
})