diff --git a/Jenkinsfile.service b/Jenkinsfile.service index b6ca38dc5..3a6077aa8 100644 --- a/Jenkinsfile.service +++ b/Jenkinsfile.service @@ -158,11 +158,6 @@ pipeline { } } } - post { - always { - cleanWs(deleteDirs: true, notFailBuild: true) - } - } } stage('部署开发或测试环境') { @@ -196,6 +191,11 @@ pipeline { } } } + post { + always { + cleanWs(deleteDirs: true, notFailBuild: true) + } + } } stage('部署单个服务') { diff --git a/scripts/test-environment-pipeline-contract.test.mjs b/scripts/test-environment-pipeline-contract.test.mjs index 5c3a924d0..b382963b2 100644 --- a/scripts/test-environment-pipeline-contract.test.mjs +++ b/scripts/test-environment-pipeline-contract.test.mjs @@ -86,7 +86,18 @@ test('Java service images use the internal registry base image by default', () = }) test('source workspaces are preserved for incremental Git fetches', () => { + const buildStage = pipeline.slice( + pipeline.indexOf("stage('构建并发布单服务')"), + pipeline.indexOf("stage('部署开发或测试环境')") + ) + const directDeployStage = pipeline.slice( + pipeline.indexOf("stage('部署开发或测试环境')"), + pipeline.indexOf("stage('部署单个服务')") + ) + assert.match(pipeline, /checkout scm/) + assert.doesNotMatch(buildStage, /cleanWs\(/) + assert.match(directDeployStage, /cleanWs\(/) assert.equal((pipeline.match(/cleanWs\(/g) ?? []).length, 2) assert.doesNotMatch(coordinatorPipeline, /cleanWs\(/) })