[Sync] [Sync] 双向合并测试 #3

Closed
fufeng_1003 wants to merge 38 commits from pr-test into master
2 changed files with 76 additions and 1 deletions
Showing only changes of commit e39280e143 - Show all commits

View File

@ -75,6 +75,6 @@ workflow:
ssh_ip: '"114.55.175.219"'
ssh_port: '"22"'
ssh_user: '"root"'
ssh_cmd: '"docker exec -d group_03_01 python issue_sync_web_simple.py"'
ssh_cmd: '"docker exec -d group_03_01 python3.9 issue_sync_web_simple.py"'
needs:
- configure_firewall

View File

@ -119,6 +119,81 @@ def application(environ, start_response):
start_response(status, headers)
return [response_data.encode('utf-8')]
elif path == '/docs' and method == 'GET':
# Simple API documentation
html_doc = '''
<!DOCTYPE html>
<html>
<head>
<title>Issue同步服务 API文档</title>
<style>
body { font-family: Arial, sans-serif; margin: 40px; }
.endpoint { margin: 20px 0; padding: 15px; border: 1px solid #ddd; }
.method { color: white; padding: 3px 8px; border-radius: 3px; }
.get { background-color: #61affe; }
.post { background-color: #49cc90; }
pre { background-color: #f5f5f5; padding: 10px; overflow-x: auto; }
</style>
</head>
<body>
<h1>Issue同步服务 API文档</h1>
<div class="endpoint">
<h3><span class="method get">GET</span> /</h3>
<p>获取服务基本信息</p>
</div>
<div class="endpoint">
<h3><span class="method get">GET</span> /status</h3>
<p>获取服务状态和支持的平台</p>
</div>
<div class="endpoint">
<h3><span class="method post">POST</span> /sync</h3>
<p>执行Issue同步</p>
<h4>请求参数</h4>
<pre>{
"source_org": "源组织名",
"source_repo": "源仓库名",
"source_platform": "源平台 (github/gitee/gitlink)",
"target_org": "目标组织名",
"target_repo": "目标仓库名",
"target_platform": "目标平台 (github/gitee/gitlink)",
"sync_comments": false
}</pre>
<h4>支持的同步方向</h4>
<ul>
<li>github gitee</li>
<li>gitee github</li>
<li>gitlink github</li>
<li>gitlink gitee</li>
<li>github gitlink</li>
<li>gitee gitlink</li>
</ul>
</div>
<div class="endpoint">
<h3>示例请求</h3>
<pre>curl -X POST http://114.55.175.219:8001/sync \\
-H "Content-Type: application/json" \\
-d '{
"source_org": "test_org",
"source_repo": "test_repo",
"source_platform": "github",
"target_org": "test_org",
"target_repo": "test_repo",
"target_platform": "gitee"
}'</pre>
</div>
</body>
</html>'''
headers = [
('Content-Type', 'text/html; charset=utf-8'),
('Content-Length', str(len(html_doc.encode('utf-8')))),
]
start_response('200 OK', headers)
return [html_doc.encode('utf-8')]
elif path == '/status' and method == 'GET':
# 状态检查
data = {