Skip to content

Commit 9b49876

Browse files
committed
chore(git): git clone with depth 1
1 parent 6056952 commit 9b49876

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

backend/app/pkgs/devops/git_tools.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ def pullCode(ws_path, repo_path, base_branch, feature_branch, gitConfigList):
2020
gitUrl = genCloneUrl(repo_path, gitConfig["git_url"], gitConfig["git_username"], gitConfig["git_token"])
2121
print(f"pullCode start {gitUrl} {base_branch} {repo_path} {ws_path}")
2222
# 先从feature_branch拉代码,如果失败再从base_branch拉
23-
result = subprocess.run(['git', 'clone', '-b', feature_branch, gitUrl, repo_path], capture_output=True, text=True, cwd=ws_path)
23+
result = subprocess.run(['git', 'clone', '-b', feature_branch, gitUrl, repo_path, '--depth', '1'], capture_output=True, text=True, cwd=ws_path)
2424
if result.returncode != 0:
2525
print("git clone feature_branch failed: "+result.stderr)
2626

27-
result = subprocess.run(['git', 'clone', '-b', base_branch, gitUrl, repo_path], capture_output=True, text=True, cwd=ws_path)
27+
result = subprocess.run(['git', 'clone', '-b', base_branch, gitUrl, repo_path, '--depth', '1'], capture_output=True, text=True, cwd=ws_path)
2828
if result.returncode != 0:
2929
print("git clone base_branch failed: "+result.stderr)
3030
# 克隆失败,说明目录已存在,尝试重置目录

backend/app/pkgs/scheduler/scheduler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
import threading
66

77
def task(app):
8-
print("scanning task ... ", datetime.now(), threading.current_thread().name)
8+
print("scanning task ... ", datetime.now(), threading.current_thread().name, flush=True)
99
with app.app_context():
1010
# 查询 任务
1111
async_task = AsyncTask.get_analyzer_code_task_one(AsyncTask.Status_Init)
1212

1313
if async_task:
14-
print("process task token : ", async_task.token, async_task.version)
14+
print("process task token : ", async_task.token, async_task.version, flush=True)
1515

1616
content = json.loads(async_task.task_content)
1717
type = content['type']

0 commit comments

Comments
 (0)