[Cmii][ImageSync] -Image Function accomplish -1

This commit is contained in:
zeaslity
2024-03-26 17:17:46 +08:00
committed by zeaslity
parent d800d5dfb8
commit 2b53db2141
14 changed files with 245 additions and 52 deletions

View File

@@ -101,7 +101,23 @@ func ImageFullNameToGzipFileName(imageFullName string) (gzipFileName string) {
func ImageFullNameToTargetImageFullName(imageFullName, targetHost string) string {
return imageFullName
if strings.HasPrefix(imageFullName, CmiiHarborPrefix) {
imageFullName = strings.TrimPrefix(imageFullName, CmiiHarborPrefix)
} else if strings.HasPrefix(imageFullName, "docker.io") {
imageFullName = strings.TrimPrefix(imageFullName, "docker.io")
}
// rancher/123:v123
if strings.HasPrefix(imageFullName, "rancher") {
return targetHost + "/" + imageFullName
}
// ossr/srs:v4.0.5
if strings.Contains(imageFullName, "/") {
imageFullName = strings.Split(imageFullName, "/")[1]
}
// srs:v4.0.5
// cmii-uav-platform:5.4.0
return targetHost + "/cmii/" + imageFullName
}
func GzipFileNameToImageFullName(gzipFileName string) (imageFullName string) {