|
|
|
@ -4,9 +4,7 @@ import (
|
|
|
|
|
"bytes"
|
|
|
|
|
"fmt"
|
|
|
|
|
"objectss/database"
|
|
|
|
|
"objectss/utils"
|
|
|
|
|
"os/exec"
|
|
|
|
|
"strings"
|
|
|
|
|
"sync"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
@ -28,21 +26,21 @@ func Consumer(channel chan string, dbw *database.DbWorker, wg *sync.WaitGroup, o
|
|
|
|
|
if ok {
|
|
|
|
|
//取出命令执行
|
|
|
|
|
if len(path) != 0 {
|
|
|
|
|
pathDir := strings.Replace(path, ".git", "", -1)
|
|
|
|
|
utils.Log.Info("path:", pathDir, "ComsumerNume:", ComsuNum)
|
|
|
|
|
//pathDir := strings.Replace(path, ".git", "", -1)
|
|
|
|
|
//utils.Log.Info("path:", pathDir, "ComsumerNume:", ComsuNum)
|
|
|
|
|
// 拷贝版本库到oss
|
|
|
|
|
ossPath := fmt.Sprintf("%s%s", osslink, pathDir)
|
|
|
|
|
copyExec := fmt.Sprintf("obsutil sync %s %s", pathDir, ossPath)
|
|
|
|
|
ossPath := fmt.Sprintf("%s%s", osslink, path)
|
|
|
|
|
copyExec := fmt.Sprintf("obsutil sync %s %s", path, ossPath)
|
|
|
|
|
|
|
|
|
|
fmt.Println("shell:", copyExec)
|
|
|
|
|
s, err := Exec_linux_shell(copyExec)
|
|
|
|
|
utils.Log.Info("copy exec_shell: ", s, " err", err)
|
|
|
|
|
// 拷贝完成后,更新数据 oss=1
|
|
|
|
|
if err == nil {
|
|
|
|
|
dbw.UpdateRepositoryOssbyPath(path)
|
|
|
|
|
} else {
|
|
|
|
|
utils.Log.Errorf("objectStore upload Failed:commad %s :Git Path %s:shell exec return %", copyExec, pathDir, s, " err", err)
|
|
|
|
|
}
|
|
|
|
|
//s, err := Exec_linux_shell(copyExec)
|
|
|
|
|
//utils.Log.Info("copy exec_shell: ", s, " err", err)
|
|
|
|
|
//// 拷贝完成后,更新数据 oss=1
|
|
|
|
|
//if err == nil {
|
|
|
|
|
// dbw.UpdateRepositoryOssbyPath(path)
|
|
|
|
|
//} else {
|
|
|
|
|
// utils.Log.Errorf("objectStore upload Failed:commad %s :Git Path %s:shell exec return %", copyExec, pathDir, s, " err", err)
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mu.Lock()
|
|
|
|
|