修复 CI 构建:合并克隆和编译步骤
Some checks failed
continuous-integration/drone/push Build is failing

问题:
- 分离的克隆步骤(alpine/git)可能存在权限或文件共享问题
- 导致后续编译步骤找不到克隆的目录

解决方案:
- 将克隆和编译合并到同一个步骤
- 使用 maven 镜像直接执行 git clone(maven 镜像包含 git)
- 在同一容器环境中完成克隆和编译,避免跨容器问题
- 添加错误处理,如果目录已存在则跳过克隆

优势:
- 简化流程,减少步骤数量
- 避免容器间文件系统共享问题
- 更可靠的执行

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
n72595987@gmail.com
2025-11-29 18:02:25 +08:00
parent 9475e164af
commit 44f01e2219

View File

@@ -10,23 +10,16 @@ trigger:
- push - push
steps: steps:
# 步骤0:克隆 BladeX 框架代码 # 步骤1:克隆并编译 BladeX 框架
- name: 克隆框架代码
image: alpine/git
commands:
- echo "克隆 BladeX 框架代码..."
- echo "当前目录:$(pwd)"
- cd /drone/src/..
- git clone https://git.waypeak.work/martial/martial-tool.git
- ls -la /drone/src/../martial-tool
- echo "✅ 框架代码克隆完成"
# 步骤1编译 BladeX 框架
- name: 编译框架依赖 - name: 编译框架依赖
image: maven:3.9-eclipse-temurin-17 image: maven:3.9-eclipse-temurin-17
commands: commands:
- echo "克隆 BladeX 框架代码..."
- cd /drone/src/..
- git clone https://git.waypeak.work/martial/martial-tool.git || echo "已存在,跳过克隆"
- ls -la
- echo "开始编译 BladeX 框架..." - echo "开始编译 BladeX 框架..."
- cd /drone/src/../martial-tool - cd martial-tool
- mvn clean install -DskipTests -q - mvn clean install -DskipTests -q
- echo "✅ BladeX 框架编译完成" - echo "✅ BladeX 框架编译完成"