perf(ci): release coordinator builder executor
This commit is contained in:
Vendored
+8
-4
@@ -36,7 +36,7 @@ def environmentChoicesForJob(String jobBaseName) {
|
|||||||
|
|
||||||
pipeline {
|
pipeline {
|
||||||
// 总控流水线只识别变更并调度独立的服务 Job;实际 Maven、镜像和部署在 Jenkinsfile.service 中完成。
|
// 总控流水线只识别变更并调度独立的服务 Job;实际 Maven、镜像和部署在 Jenkinsfile.service 中完成。
|
||||||
agent { label 'java-builder' }
|
agent none
|
||||||
|
|
||||||
options {
|
options {
|
||||||
disableConcurrentBuilds()
|
disableConcurrentBuilds()
|
||||||
@@ -69,6 +69,7 @@ pipeline {
|
|||||||
|
|
||||||
stages {
|
stages {
|
||||||
stage('确定构建范围') {
|
stage('确定构建范围') {
|
||||||
|
agent { label 'java-builder' }
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
// 开发环境总控 Job 固定部署到 development,避免首次构建沿用 ENVIRONMENT 的默认 test 值。
|
// 开发环境总控 Job 固定部署到 development,避免首次构建沿用 ENVIRONMENT 的默认 test 值。
|
||||||
@@ -151,6 +152,11 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
post {
|
||||||
|
always {
|
||||||
|
cleanWs(deleteDirs: true, notFailBuild: true)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('生产环境部署确认(仅 production 执行)') {
|
stage('生产环境部署确认(仅 production 执行)') {
|
||||||
@@ -170,6 +176,7 @@ pipeline {
|
|||||||
expression { env.RESOLVED_ENVIRONMENT == 'test' && params.INITIALIZE_TEST_DATABASE }
|
expression { env.RESOLVED_ENVIRONMENT == 'test' && params.INITIALIZE_TEST_DATABASE }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
agent { label 'java-test' }
|
||||||
steps {
|
steps {
|
||||||
sh 'sh deploy/scripts/initialize-test-databases.sh'
|
sh 'sh deploy/scripts/initialize-test-databases.sh'
|
||||||
}
|
}
|
||||||
@@ -225,7 +232,4 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
post {
|
|
||||||
always { cleanWs(deleteDirs: true, notFailBuild: true) }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,9 +5,12 @@ import test from 'node:test'
|
|||||||
const pipeline = (await readFile(new URL('../Jenkinsfile', import.meta.url), 'utf8'))
|
const pipeline = (await readFile(new URL('../Jenkinsfile', import.meta.url), 'utf8'))
|
||||||
.replaceAll('\r\n', '\n')
|
.replaceAll('\r\n', '\n')
|
||||||
|
|
||||||
test('coordinator runs only on the shared Java builder pool', () => {
|
test('coordinator releases its builder while waiting for downstream jobs', () => {
|
||||||
|
assert.match(pipeline, /pipeline \{[\s\S]*?agent none/)
|
||||||
|
assert.match(pipeline, /stage\('确定构建范围'\) \{[\s\S]*?agent \{ label 'java-builder' \}/)
|
||||||
assert.match(pipeline, /agent \{ label 'java-builder' \}/)
|
assert.match(pipeline, /agent \{ label 'java-builder' \}/)
|
||||||
assert.doesNotMatch(pipeline, /agent any/)
|
assert.doesNotMatch(pipeline, /agent any/)
|
||||||
|
assert.doesNotMatch(pipeline, /post \{\s*always \{ cleanWs[\s\S]*?\}\s*\}\s*\}\s*$/)
|
||||||
})
|
})
|
||||||
|
|
||||||
test('AUTO detects database migrations without expanding them to all services', () => {
|
test('AUTO detects database migrations without expanding them to all services', () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user