feat: refact syncrepo using go

This commit is contained in:
engigu
2026-02-27 11:35:55 +08:00
parent 54409696c4
commit 578e020f0d
10 changed files with 370 additions and 342 deletions
+8 -2
View File
@@ -5,6 +5,7 @@ import (
"encoding/json"
"fmt"
"io"
"os"
"path/filepath"
"strings"
"sync"
@@ -819,8 +820,13 @@ func (es *ExecutorService) BuildRepoCommand(task *models.Task) (string, string)
}
absTargetPath, _ := filepath.Abs(targetPath)
exePath, err := os.Executable()
if err != nil {
exePath = "baihu" // Fallback if executable path can't be found
}
args := []string{
"/opt/sync.py",
"reposync",
"--source-type", config.SourceType,
"--source-url", config.SourceURL,
"--target-path", absTargetPath,
@@ -844,7 +850,7 @@ func (es *ExecutorService) BuildRepoCommand(task *models.Task) (string, string)
args = append(args, "--auth-token", config.AuthToken)
}
return "python3 " + strings.Join(args, " "), "/opt"
return exePath + " " + strings.Join(args, " "), filepath.Dir(exePath)
}
// loadEnvVars 加载环境变量