diff --git a/Jenkinsfile.service b/Jenkinsfile.service index 8dae16c76..854f77a93 100644 --- a/Jenkinsfile.service +++ b/Jenkinsfile.service @@ -41,7 +41,7 @@ pipeline { environment { REGISTRY_CREDENTIALS = 'gitea-test-token' - MAVEN_SETTINGS = 'deploy/maven/settings-cn.xml' + MAVEN_SETTINGS = 'deploy/maven/settings-ci.xml' MAVEN_OPTS = '-Dfile.encoding=UTF-8 -Dmaven.wagon.http.retryHandler.count=3' DEVELOPMENT_SSH_TARGET = 'deploy@172.31.198.8' DEVELOPMENT_SSH_KEY = '/var/jenkins_home/.ssh/dev_deploy' diff --git a/deploy/maven/settings-ci.xml b/deploy/maven/settings-ci.xml new file mode 100644 index 000000000..44e005ada --- /dev/null +++ b/deploy/maven/settings-ci.xml @@ -0,0 +1,39 @@ + + + + + aliyun-public + 阿里云 Maven 公共仓库 + https://maven.aliyun.com/repository/public + central + + + + + + 国内-CI-仓库 + + + central + https://repo.maven.apache.org/maven2 + true + false + + + + + central + https://repo.maven.apache.org/maven2 + true + false + + + + + + + 国内-CI-仓库 + + diff --git a/scripts/test-environment-pipeline-contract.test.mjs b/scripts/test-environment-pipeline-contract.test.mjs index f995dd738..d946069f6 100644 --- a/scripts/test-environment-pipeline-contract.test.mjs +++ b/scripts/test-environment-pipeline-contract.test.mjs @@ -6,6 +6,8 @@ const pipeline = (await readFile(new URL('../Jenkinsfile.service', import.meta.u .replaceAll('\r\n', '\n') const deployScript = (await readFile(new URL('../deploy/scripts/deploy-services.sh', import.meta.url), 'utf8')) .replaceAll('\r\n', '\n') +const ciMavenSettings = (await readFile(new URL('../deploy/maven/settings-ci.xml', import.meta.url), 'utf8')) + .replaceAll('\r\n', '\n') test('test deployments compile packages without rerunning the full unit test suite', () => { assert.match(pipeline, /params\.ENVIRONMENT == 'test' \|\| params\.SKIP_TESTS/) @@ -25,3 +27,9 @@ test('Java builds use the shared builder pool and deploy on the target environme assert.match(pipeline, /docker push \$\{image\}/) assert.match(deployScript, /pull \$SERVICES/) }) + +test('shared builders use a reachable public Maven mirror instead of the retired private proxy', () => { + assert.match(pipeline, /MAVEN_SETTINGS = 'deploy\/maven\/settings-ci\.xml'/) + assert.match(ciMavenSettings, /https:\/\/maven\.aliyun\.com\/repository\/public/) + assert.doesNotMatch(ciMavenSettings, /:18081/) +})