[ Agent ] [ Executor ] - 增加Pipeline部分的代码

This commit is contained in:
zeaslity
2023-10-18 09:26:58 +08:00
parent 0e8f633166
commit be01eb28a9
8 changed files with 192 additions and 94 deletions

View File

@@ -1,6 +1,9 @@
package executor
import "os/exec"
import (
"fmt"
"os/exec"
)
var RemoveForcePrefix = []string{"rm", "-rf"}
@@ -59,14 +62,22 @@ func BasicFileExists(filename string) bool {
}
}
// BasicFileExistAndNotNull 文件不为空返回true 文件为空返回false
func BasicFileExistAndNotNull(filename string) bool {
cmd := exec.Command("test", "-z", filename)
cmd := exec.Command("test", "-s", filename)
err := cmd.Run()
if err != nil {
log.DebugF("文件 %s 不存在", filename)
log.DebugF("文件 %s 为空", filename)
return false
} else {
return true
}
}
func BasicPrettyPrint(resultOk bool, resultLog []string) {
fmt.Printf("resultOK is => %#v\n", resultOk)
for _, s := range resultLog {
fmt.Println(s)
}
}