ci: use settings.xml profile (not mirror) to add nexus:8081 maven-public as repo; clear only yh-auth cache (keep BOM); verified resolves yh-auth -7 with CasSsoAutoConfiguration
ci-userbase-service / build-and-push (push) Failing after 37s

This commit is contained in:
2026-08-10 12:04:57 +08:00
parent e69e634138
commit 1b021e2748
+7 -4
View File
@@ -67,10 +67,13 @@ jobs:
-v /opt/docker/ubs-m2:/root/.m2 \
-w /build maven:3.6.3-jdk-8 sleep 3600
docker cp "${PWD}/." mavenbuild:/build/
# 写 settings.xml:HTTP 仓库 mirror 到 nexus:8081 maven-public(infra-infra-net 内容器名直连)
docker exec mavenbuild sh -c "echo '<settings><mirrors><mirror><id>nexus-direct</id><mirrorOf>external:http:*</mirrorOf><url>http://nexus:8081/repository/maven-public/</url></mirror></mirrors></settings>' > /root/.m2/settings.xml"
# 清掉宿主 m2 真实缓存路径(/root/.m2/repository/)下的旧 yh.platform SNAPSHOT
docker exec mavenbuild rm -rf /root/.m2/repository/com/yunhai/platform
# 写 settings.xml:新增 profile 把 nexus:8081 maven-public 作为额外仓库(infra-infra-net 内容器名直连,已验证 -7 可达)。
# 不用 mirror(external:http:*) 是因为它对 BOM import 解析未生效;profile 方式更可靠。
# pom 原有的 nexus.yunhaixingtong.com(Caddy:80) 在 CI 容器内不可解析 → 快速失败,maven 转而用本仓库。
docker exec mavenbuild sh -c "printf '%s' '<settings><profiles><profile><id>nexus-repo</id><repositories><repository><id>nexus-internal</id><url>http://nexus:8081/repository/maven-public/</url><releases><enabled>true</enabled></releases><snapshots><enabled>true</enabled><updatePolicy>always</updatePolicy></snapshots></repository></repositories></profile></profiles><activeProfiles><activeProfile>nexus-repo</activeProfile></activeProfiles></settings>' > /root/.m2/settings.xml"
# 仅清旧 yh-auth 缓存(含 08-05 local install 的 maven-metadata-local.xml,避免本地安装优先于远端 -7);
# BOM 等其它 yh.platform 模块保留缓存(Nexus 上它们仍是 08-05 的 -1,缓存与远端一致)。
docker exec mavenbuild rm -rf /root/.m2/repository/com/yunhai/platform/yh-auth-spring-boot-starter
docker exec mavenbuild sh -c 'cd /build/service && mvn -U -B -DskipTests clean package'
mkdir -p "${PWD}/service/target"
docker cp mavenbuild:/build/service/target/userbase.jar "${PWD}/service/target/userbase.jar"