Files
docs-test/docs/devstar/ai-devops.md

87 lines
2.4 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.
# DevStar AI+ DevOps
DevStar AI+ DevOps 是一个完整的AI驱动研发平台解决方案通过集成 DevStar平台、代码大语言模型、Gitea MCP Server和 AI Code ToolsCursor、Claude Code、iFlow等为开发者提供智能化研发支撑体系。
## 🚀 快速部署
### 一、部署 DevStar 代码托管平台
Ubuntu-20.04下完成安装:
```
wget -c https://devstar.cn/assets/install.sh && chmod +x install.sh && sudo ./install.sh
sudo devstar start
```
安装完成后我们得到DevStar代码托管平台的URL比如http://172.16.94.26:80
### 二、Ollama私有部署代码大模型
Ubuntu-20.04下完成安装:
```
curl -fsSL https://ollama.com/install.sh | sh
# 验证是否安装成功
ollama --version
# 下载Qwen2.5-Coder大模型
ollama pull qwen2.5-coder:32b
# 列出已下载的模型
ollama list
# 测试模型
ollama run qwen2.5-coder:32b "Hello, can you help me code?"
# 启动Ollama服务 (默认端口11434)
ollama serve
# 验证服务状态
curl http://172.16.94.26:11434/api/tags
```
* 解决Ollama只能本地访问的问题
```
# 添加环境变量OLLAMA_HOST=0.0.0.0和OLLAMA_ORIGINS=*
sed -i '/\[Service\]/a Environment=OLLAMA_HOST=0.0.0.0' /etc/systemd/system/ollama.service
sed -i '/\[Service\]/a Environment=OLLAMA_ORIGINS=*' /etc/systemd/system/ollama.service
# 重新加载并重启
systemctl daemon-reexec
systemctl daemon-reload
systemctl restart ollama
```
安装完成后我们得到API URL,比如http://172.16.94.26:11434/api/tags model比如qwen2.5-coder:32b token比如TOKEN***************
### 三、配置AI Code Review到CI/CD工作流中
在您的项目中添加.gitea/workflows/code-review.yml , 这里使用kekxv/AiReviewPR@v0.0.6来进行AI Code Review
```
name: ai-reviews
on:
pull_request:
types: [opened, synchronize]
jobs:
review:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Review code
uses: kekxv/AiReviewPR@v0.0.6
with:
model: ${{ vars.MODEL }}
host: ${{ vars.OLLAMA_HOST }}
REVIEW_PULL_REQUEST: false
```
DevStar代码托管平台中项目设置、用户设置和后台管理中都可以设置变量vars.MODEL、vars.OLLAMA_HOST等。
### 四、使用ai-develops项目模板完整演示DevStar AI+ DevOps的CI/CD工作流及AI Code Review
todo