Files
springboot-cici-demo/PLAN_AND_REVIEW.md
yangzelin 5c7ee32d17
Some checks failed
Build and Push Docker Image / build-and-push (push) Has been cancelled
feat: 创建 Spring Boot 4 项目及 Gitea/GitLab CI/CD 流水线
2026-12-04 13:50:19 +08:00

37 lines
1.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Spring Boot 4 + Gitea/GitLab CI/CD POC — 计划与复盘
## 一、需求摘要
- 在 `supply-controll-tower/backend` 目录创建 Spring Boot 4 项目,提供返回字符串的简单接口。
- 使用 Gitea 托管代码,提交后由 CI/CD 自动编译、构建 Docker 镜像并推送至阿里云容器镜像仓库 `registry.cn-hangzhou.aliyuncs.com/lightjob`。
- 同时提供 GitLab CI 流水线定义。
- 全程记录过程与结果,便于复盘。
## 二、实施计划
| 步骤 | 内容 | 产出 |
|---|---|---|
| 1 | 确认环境(JDK/Maven/Docker/网络)并制定计划 | 本文件 |
| 2 | 创建 Spring Boot 4 Maven 工程(含 Maven Wrapper)与 `GET /api/hello` 接口 | `pom.xml`、`src/`、`mvnw` |
| 3 | 编写接口测试并本地编译、执行单元测试通过 | `*Test.java` + 测试报告 |
| 4 | 编写多阶段 Dockerfile、Gitea Actions 与 GitLab CI 流水线 | `Dockerfile`、`.gitea/workflows/ci.yaml`、`.gitlab-ci.yml` |
| 5 | 本地验证镜像构建;初始化 Git 仓库并推送代码到 Gitea,触发/核查流水线 | Git 提交记录、镜像/流水线状态 |
| 6 | 汇总过程、结果、遇到的问题与遗留事项 | 本文件「复盘」章节 |
## 三、设计决策
- Spring Boot `4.2.0`(2026-12 稳定版),Java 21(本机 JDK 21,Boot 4 基线要求 JDK 17+)。
- 构建工具 Maven 3.9.12 Wrapper:CI 无需预装 Maven,统一版本。
- 接口返回纯文本字符串,路径 `GET /api/hello`。
- 镜像 tag 使用 `commit 短 SHA`,同时打 `latest`;凭据通过 CI Secrets/Variables 注入,不写入代码仓库。
- Dockerfile 构建阶段执行 `./mvnw verify`(含单元测试),测试不通过则不产出镜像。
- Gitea 使用 Actions(`.gitea/workflows/`),GitLab 使用 `.gitlab-ci.yml`(Docker-in-Docker)。
## 四、执行记录
(执行过程中补充)
## 五、复盘
(完成后补充)