[Agent][GO] - fix docker deploy version

This commit is contained in:
zeaslity
2024-07-17 11:00:42 +08:00
parent 975cc54766
commit 034ae3d25b
3 changed files with 17 additions and 3 deletions

View File

@@ -200,13 +200,27 @@ func TestGzipFileNameToImageFullName(t *testing.T) {
}
}
func TestImageGzipFileNameToImageFullName_1(t *testing.T) {
gzipFilePrefix := "/root/octopus_image/middle/"
filepath.WalkDir(gzipFilePrefix, func(path string, d os.DirEntry, err error) error {
//fmt.Println(path)
name := d.Name()
if strings.HasSuffix(name, ".tar.gz") {
fullName := GzipFileNameToImageFullName(name)
fmt.Println(fullName)
}
return nil
})
}
func TestImageGzipFileNameToImageFullName(t *testing.T) {
frontendMap := make(map[string]string)
backendMap := make(map[string]string)
srsMap := make(map[string]string)
gzipFilePrefix := "/root/octopus_image/xjyd/"
gzipFilePrefix := "/root/octopus_image/middle/"
filepath.WalkDir(gzipFilePrefix, func(path string, d os.DirEntry, err error) error {
//fmt.Println(path)
name := d.Name()

View File

@@ -866,7 +866,7 @@ func (op *AgentOsOperator) installDockerExec(args []string) (bool, []string) {
// get by method
ok, log4 := HardCodeCommandExecutor("apt-cache madison docker-ce | grep 20.10.20 | awk '{print$3}'")
if ok {
if ok && log4 != nil && len(log4) > 0 {
specificDockerVersion = strings.TrimSpace(log4[0])
}

View File

@@ -183,7 +183,7 @@ func TestHardCodeCommandExecutor(t *testing.T) {
// get by method
ok, log4 := HardCodeCommandExecutor("apt-cache madison docker-ce | grep 20.10.20 | awk '{print$3}'")
if ok {
if ok && log4 != nil && len(log4) > 0 {
specificDockerVersion = strings.TrimSpace(log4[0])
}