[ Cmii ] [ Octopus ] - 实际项目
This commit is contained in:
@@ -355,7 +355,7 @@ func PullFromListAndCompressSplit(fullImageNameList []string, gzipFolder string)
|
||||
errorGzipImageList = append(errorGzipImageList, image)
|
||||
continue
|
||||
}
|
||||
tarGzipFileNameList = append(tarGzipFileNameList, convertImageGzipFileName(image))
|
||||
tarGzipFileNameList = append(tarGzipFileNameList, ImageFullNameToGzipFileName(image))
|
||||
}
|
||||
|
||||
utils.BeautifulPrintListWithTitle(tarGzipFileNameList, "image gzip name list")
|
||||
@@ -431,7 +431,7 @@ func SaveToTarGZ(targetImageName, folderPathPrefix string) bool {
|
||||
}
|
||||
}
|
||||
|
||||
gzipImageFile := convertImageGzipFileName(realImageTag)
|
||||
gzipImageFile := ImageFullNameToGzipFileName(realImageTag)
|
||||
if !strings.HasSuffix(folderPathPrefix, "/") {
|
||||
folderPathPrefix += "/"
|
||||
}
|
||||
@@ -463,66 +463,6 @@ func SaveToTarGZ(targetImageName, folderPathPrefix string) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// convertImageGzipFileName 必须输出长度为4的内容 =出现得次数为3
|
||||
func convertImageGzipFileName(imageRepoTag string) (gzipFileName string) {
|
||||
|
||||
// harbor.cdcyy.cn/cmii/cmii-uav-platform:5.4.0 ==> cmlc=cmii=cmii-uav-platform=5.4.0.tar.gz
|
||||
// rancher/fleet:v0.3.4
|
||||
|
||||
// ossr/srs:v5.0.1 ==> docker=cmii=srs=v5.0.1.tar.gz
|
||||
// nginx:latest
|
||||
// bitnami/minio:2022.5.4
|
||||
// simonrupf/chronyd:0.4.3
|
||||
|
||||
// 10.1.1.1:8033/cmii/ok:1.2 不支持 不允许存在
|
||||
|
||||
split := strings.Split(imageRepoTag, ":")
|
||||
//log.DebugF(" %s to %s", imageRepoTag, split)
|
||||
if len(split) == 1 {
|
||||
// nginx
|
||||
return "docker=library=" + imageRepoTag + "=latest.tar.gz"
|
||||
}
|
||||
|
||||
first := strings.Split(split[0], "/")
|
||||
//log.DebugF(" split[0] %s to %s", split[0], first)
|
||||
if len(first) == 3 {
|
||||
// harbor.cdcyy.cn/cmii/cmii-uav-platform:5.4.0
|
||||
// docker.io/ossr/srs:v5.0.1
|
||||
if strings.HasPrefix(split[0], CmiiHarborPrefix) {
|
||||
gzipFileName += "cmlc=cmii="
|
||||
} else {
|
||||
gzipFileName += "docker=cmii="
|
||||
}
|
||||
gzipFileName += first[2]
|
||||
gzipFileName += "="
|
||||
|
||||
} else if len(first) == 4 {
|
||||
// harbor.cdcyy.cn/cmii/ossr/srs:v5.0.1
|
||||
if !strings.HasPrefix(split[0], CmiiHarborPrefix) {
|
||||
return imageRepoTag
|
||||
}
|
||||
gzipFileName += "cmlc=cmii="
|
||||
gzipFileName += first[3]
|
||||
gzipFileName += "="
|
||||
} else if len(first) == 2 {
|
||||
// bitnami/redis
|
||||
// ossrs/srs
|
||||
gzipFileName += "docker="
|
||||
gzipFileName += first[0]
|
||||
gzipFileName += "="
|
||||
gzipFileName += first[1]
|
||||
gzipFileName += "="
|
||||
} else if len(first) == 1 {
|
||||
// nginx:latest
|
||||
return "docker=library=" + split[0] + "=" + split[1] + ".tar.gz"
|
||||
}
|
||||
|
||||
gzipFileName += split[1]
|
||||
gzipFileName += ".tar.gz"
|
||||
|
||||
return gzipFileName
|
||||
}
|
||||
|
||||
func ConvertCMiiImageMapToList(cmiiImageVersionMap map[string]string) (fullImageNameList []string) {
|
||||
|
||||
for image, tag := range cmiiImageVersionMap {
|
||||
|
||||
Reference in New Issue
Block a user