提交 030891a0 编写于 作者: 雨爱无痕

Remove test code

上级 10ac5fb2
......@@ -2,7 +2,6 @@ package main
import (
"flag"
"fmt"
"os"
"os/signal"
"strconv"
......@@ -12,7 +11,6 @@ import (
"github.com/easysoft/zentaoatf/internal/command/action"
commandConfig "github.com/easysoft/zentaoatf/internal/command/config"
commConsts "github.com/easysoft/zentaoatf/internal/pkg/consts"
gitHelper "github.com/easysoft/zentaoatf/internal/pkg/helper/git"
unitHelper "github.com/easysoft/zentaoatf/internal/pkg/helper/unit"
websocketHelper "github.com/easysoft/zentaoatf/internal/pkg/helper/websocket"
"github.com/easysoft/zentaoatf/internal/server/core/cron"
......@@ -135,10 +133,6 @@ func main() {
run(os.Args)
case "-P":
server(os.Args)
case "clone":
clone(os.Args)
case "pull":
pull(os.Args)
default: // run
if len(os.Args) > 1 {
......@@ -302,35 +296,3 @@ func server(args []string) {
webServer.Run()
}
func clone(args []string) {
url := ""
if len(args) >= 3 {
url = args[2]
}
build := gitHelper.Build{
ScmAddress: url,
Username: "yuaiwuhen@hotmail.com",
Password: "zhaoke5272",
RsaKey: `/root/.ssh/id_rsa`,
WorkDir: "/root/",
}
err := gitHelper.CheckoutCodes(&build)
fmt.Println(err)
}
func pull(args []string) {
url := ""
if len(args) >= 3 {
url = args[2]
}
build := gitHelper.Build{
ScmAddress: url,
Username: "yuaiwuhen@hotmail.com",
Password: "zhaoke5272",
RsaKey: `/root/.ssh/id_rsa`,
WorkDir: "/root/",
}
err := gitHelper.ForcePull(&build, true)
fmt.Println(111111111111111, err)
}
......@@ -2,7 +2,6 @@ package gitHelper
import (
"errors"
"fmt"
"os"
"strings"
......@@ -29,7 +28,6 @@ func CheckoutCodes(build *Build) (err error) {
projectDir := build.WorkDir + GetGitProjectName(url) + commConsts.PthSep
build.ProjectDir = projectDir
fmt.Println(projectDir, url)
fileUtils.MkDirIfNeeded(projectDir)
options := git.CloneOptions{
......@@ -44,12 +42,10 @@ func CheckoutCodes(build *Build) (err error) {
}
if build.RsaKey != "" {
_, err = os.Stat(build.RsaKey)
fmt.Println(err, build.RsaKey)
if err != nil {
return
}
options.Auth, err = ssh.NewPublicKeysFromFile("git", build.RsaKey, password)
fmt.Println(1111, options.Auth, err)
if err != nil {
return
}
......@@ -79,7 +75,6 @@ func Pull(build *Build) (err error) {
projectDir := build.WorkDir + GetGitProjectName(url) + commConsts.PthSep
build.ProjectDir = projectDir
}
fmt.Println(build.ProjectDir)
options := git.PullOptions{
Progress: os.Stdout,
}
......@@ -123,7 +118,6 @@ func ForcePull(build *Build, force bool) (err error) {
projectDir := build.WorkDir + GetGitProjectName(url) + commConsts.PthSep
build.ProjectDir = projectDir
}
fmt.Println(build.ProjectDir)
options := git.PullOptions{
Progress: os.Stdout,
Force: force,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册