[ Cmii ] [ Octopus ] - add some features

This commit is contained in:
zeaslity
2024-03-22 16:09:57 +08:00
parent 8e6f09d522
commit 46b9ba59e9
8 changed files with 105 additions and 31 deletions

View File

@@ -14,6 +14,7 @@ var MiddlewareAmd64 = []string{
"ossrs/srs:v5.0.195",
"ossrs/srs:v4.0-r3",
"emqx/emqx:4.2.12",
"emqx/emqx:5.5.1",
"nacos/nacos-server:v2.1.2",
"nacos/nacos-server:v2.1.2-slim",
"mongo:5.0",

View File

@@ -3,10 +3,8 @@ package image
import (
"bufio"
"fmt"
"strconv"
"strings"
"testing"
"time"
"wdd.io/agent-common/assert"
"wdd.io/agent-common/utils"
)
@@ -161,28 +159,37 @@ func TestImageTagFromSourceToTarget(t *testing.T) {
}
func fibonacci(c, quit chan int64) {
x, y := int64(0), int64(1)
for {
select {
case c <- x:
x, y = y, x+y
fmt.Println("count is " + strconv.FormatInt(int64(<-c), 10))
case <-quit:
fmt.Println("quit current x is " + strconv.FormatInt(int64(x), 10))
func TestSaveSpecificImageToGzipFile(t *testing.T) {
imageGzipFilePathPrefix := "/root/ai_image/"
imageFullNameList := []string{
"harbor.cdcyy.com.cn/cmii/cmlc-ai/cmlc-ai-operator:v5.2.0-t4-no-dino",
}
for _, imageFullName := range imageFullNameList {
result := PullFromCmiiHarbor(imageFullName)
if result == nil {
log.ErrorF("image pull error ! => %s", imageFullName)
return
}
scc := bufio.NewScanner(result)
for scc.Scan() {
line := scc.Text()
if strings.Contains(line, "\"status\":\"Pulling from") {
fmt.Println(line)
}
if strings.Contains(line, "Status: Image is up to date for") {
fmt.Println(line)
}
}
// image pull success
if !SaveToTarGZ(imageFullName, imageGzipFilePathPrefix) {
log.ErrorF("image save to gzip file error ! => %s", imageFullName)
return
}
}
}
func TestWriteDependencyImageToFile(t *testing.T) {
//WriteDependencyImageToFile()
c := make(chan int64, 1)
quit := make(chan int64, 1)
go fibonacci(c, quit)
after := time.After(time.Second)
<-after
quit <- 1
}

View File

@@ -69,6 +69,7 @@ func ImageFullNameToGzipFileName(imageFullName string) (gzipFileName string) {
} else if len(first) == 4 {
// harbor.cdcyy.cn/cmii/ossr/srs:v5.0.1
// harbor.cdcyy.com.cn/cmii/cmlc-ai/cmlc-ai-operator:v5.2.0-t4-no-dino
if !strings.HasPrefix(split[0], CmiiHarborPrefix) {
return imageFullName
}