fix: sync repo target-paht error
This commit is contained in:
+2
-1
@@ -79,7 +79,8 @@ COPY docker-entrypoint.sh .
|
|||||||
COPY sync.py /opt/sync.py
|
COPY sync.py /opt/sync.py
|
||||||
RUN chmod +x /opt/sync.py \
|
RUN chmod +x /opt/sync.py \
|
||||||
&& chmod +x docker-entrypoint.sh \
|
&& chmod +x docker-entrypoint.sh \
|
||||||
&& touch "dont-not-delete-anythings"
|
&& touch "dont-not-delete-anythings" \
|
||||||
|
&& echo "set encoding=utf-8" >> /etc/vim/vimrc
|
||||||
|
|
||||||
EXPOSE 8052
|
EXPOSE 8052
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
@@ -354,12 +355,25 @@ func (es *ExecutorService) executeRepoTask(task *models.Task) *ExecutionResult {
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 处理目标路径:为空则使用 scripts 目录,相对路径则基于 scripts 目录
|
||||||
|
targetPath := config.TargetPath
|
||||||
|
if targetPath == "" {
|
||||||
|
targetPath = constant.ScriptsWorkDir
|
||||||
|
} else if !filepath.IsAbs(targetPath) {
|
||||||
|
targetPath = filepath.Join(constant.ScriptsWorkDir, targetPath)
|
||||||
|
}
|
||||||
|
// 转换为绝对路径
|
||||||
|
absTargetPath, err := filepath.Abs(targetPath)
|
||||||
|
if err != nil {
|
||||||
|
absTargetPath = targetPath
|
||||||
|
}
|
||||||
|
|
||||||
// 构建 sync.py 命令参数
|
// 构建 sync.py 命令参数
|
||||||
args := []string{
|
args := []string{
|
||||||
"/opt/sync.py",
|
"/opt/sync.py",
|
||||||
"--source-type", config.SourceType,
|
"--source-type", config.SourceType,
|
||||||
"--source-url", config.SourceURL,
|
"--source-url", config.SourceURL,
|
||||||
"--target-path", config.TargetPath,
|
"--target-path", absTargetPath,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Git 分支
|
// Git 分支
|
||||||
|
|||||||
Reference in New Issue
Block a user