Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhaohua-project-kb
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bos-project-kb
zhaohua-project-kb
Commits
4f496c52
Commit
4f496c52
authored
Jul 08, 2026
by
刘正强
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: push_config_fixed.py 兼容本地 remote_sync.py (pull|push)
- 当 issues-ops 远端仓库不存在时,先准备本地缓存 - 远端仓库创建后,重跑本脚本即可完成 push 和 registry 登记
parent
c4eb1f13
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
8 deletions
+6
-8
push_config_fixed.py
bos-ai-platform/scripts/push_config_fixed.py
+6
-8
No files found.
bos-ai-platform/scripts/push_config_fixed.py
View file @
4f496c52
#!/usr/bin/env python3
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
"""push_config.py 的本地兼容版本。
r
"""push_config.py 的本地兼容版本。
修复:本地 bos-issue-ledger/scripts/remote_sync.py 只支持 --cmd pull|push,
修复:本地 bos-issue-ledger/scripts/remote_sync.py 只支持 --cmd pull|push,
不支持 push-mr;本脚本使用 --cmd push 并去掉不支持的参数。
不支持 push-mr;本脚本使用 --cmd push 并去掉不支持的参数。
...
@@ -59,7 +59,7 @@ def main():
...
@@ -59,7 +59,7 @@ def main():
git_root
=
os
.
path
.
join
(
cache_dir
,
project_slug
)
git_root
=
os
.
path
.
join
(
cache_dir
,
project_slug
)
target_dir
=
os
.
path
.
join
(
git_root
,
subdir
)
if
subdir
else
git_root
target_dir
=
os
.
path
.
join
(
git_root
,
subdir
)
if
subdir
else
git_root
# 如果缓存不存在,先尝试 clone;失败则初始化
裸缓存并加 remote
# 如果缓存不存在,先尝试 clone;失败则初始化
本地缓存并加 remote,等远端可用后再推
if
not
os
.
path
.
isdir
(
os
.
path
.
join
(
git_root
,
".git"
)):
if
not
os
.
path
.
isdir
(
os
.
path
.
join
(
git_root
,
".git"
)):
print
(
json
.
dumps
({
"step"
:
"clone"
,
"repo"
:
repo
},
ensure_ascii
=
False
))
print
(
json
.
dumps
({
"step"
:
"clone"
,
"repo"
:
repo
},
ensure_ascii
=
False
))
r
=
subprocess
.
run
(
r
=
subprocess
.
run
(
...
@@ -69,19 +69,17 @@ def main():
...
@@ -69,19 +69,17 @@ def main():
"--cache-dir"
,
cache_dir
],
"--cache-dir"
,
cache_dir
],
capture_output
=
True
,
text
=
True
)
capture_output
=
True
,
text
=
True
)
if
r
.
returncode
!=
0
:
if
r
.
returncode
!=
0
:
# 远端不存在或无法访问:初始化本地缓存,等远端可用后再推
print
(
json
.
dumps
({
print
(
json
.
dumps
({
"ok"
:
False
,
"step"
:
"clone/pull"
,
"step"
:
"clone/pull"
,
"error"
:
(
r
.
stderr
or
r
.
stdout
)
.
strip
()[:
500
],
"note"
:
"远端仓库可能尚未创建或无访问权限,转为本地缓存准备。"
"note"
:
"远端仓库可能尚未创建或无访问权限。已在本地准备缓存,远端可用后请重跑本脚本。"
},
ensure_ascii
=
False
))
},
ensure_ascii
=
False
))
sys
.
exit
(
1
)
os
.
makedirs
(
git_root
,
exist_ok
=
True
)
subprocess
.
run
([
"git"
,
"init"
],
cwd
=
git_root
,
capture_output
=
True
)
subprocess
.
run
([
"git"
,
"remote"
,
"add"
,
"origin"
,
repo
],
cwd
=
git_root
,
capture_output
=
True
)
# 把当前 KB 文件同步到缓存目录
# 把当前 KB 文件同步到缓存目录
if
os
.
path
.
abspath
(
kb
)
!=
os
.
path
.
abspath
(
target_dir
):
if
os
.
path
.
abspath
(
kb
)
!=
os
.
path
.
abspath
(
target_dir
):
os
.
makedirs
(
target_dir
,
exist_ok
=
True
)
os
.
makedirs
(
target_dir
,
exist_ok
=
True
)
# 复制 list-config.md 及 issues/、assets/ 等
for
item
in
os
.
listdir
(
kb
):
for
item
in
os
.
listdir
(
kb
):
src
=
os
.
path
.
join
(
kb
,
item
)
src
=
os
.
path
.
join
(
kb
,
item
)
dst
=
os
.
path
.
join
(
target_dir
,
item
)
dst
=
os
.
path
.
join
(
target_dir
,
item
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment