[ Cmii ] [ Octopus ] - image sync refresh
This commit is contained in:
@@ -237,7 +237,7 @@ func TestUpdateCmiiDeploymentImageTag(t *testing.T) {
|
||||
|
||||
cmiiEnv := demo
|
||||
appName := "cmii-uav-platform"
|
||||
newTag := "5.4.0-25263-0311"
|
||||
newTag := "5.4.0-031901"
|
||||
|
||||
tag := UpdateCmiiDeploymentImageTag(cmiiEnv, appName, newTag)
|
||||
assert.Equal(t, tag, true, "update image tag failed !")
|
||||
|
||||
@@ -44,7 +44,7 @@ func (sync ImageSyncEntity) PullFromEntityAndSyncConditionally() (imageSyncResul
|
||||
// get all image name by Name or Version
|
||||
// pull images
|
||||
// compress
|
||||
if sync.ProjectVersion == "" {
|
||||
if sync.ProjectVersion != "" {
|
||||
// get version
|
||||
if sync.DirectHarborHost == "" {
|
||||
errorPullImageList, errorGzipImageList, allCmiiImageNameList = FetchVersionImages(sync.ProjectVersion, true)
|
||||
@@ -62,8 +62,9 @@ func (sync ImageSyncEntity) PullFromEntityAndSyncConditionally() (imageSyncResul
|
||||
}
|
||||
}
|
||||
|
||||
realCmiiImageList = append(realCmiiImageList, remove(allCmiiImageNameList, errorPullImageList)...)
|
||||
realCmiiImageList = append(realCmiiImageList, remove(allCmiiImageNameList, errorGzipImageList)...)
|
||||
// todo function error
|
||||
realCmiiImageList = remove(allCmiiImageNameList, errorPullImageList)
|
||||
realCmiiImageList = remove(allCmiiImageNameList, errorGzipImageList)
|
||||
|
||||
// direct push if can
|
||||
if sync.DirectHarborHost != "" {
|
||||
|
||||
@@ -196,11 +196,14 @@ func TagFromListAndPushToCHarbor(referenceImageList []string, targetHarborHost s
|
||||
targetProject = "rancher"
|
||||
}
|
||||
|
||||
if strings.Contains(imageName, "/") {
|
||||
if strings.HasPrefix(imageName, CmiiHarborPrefix) {
|
||||
//
|
||||
imageName = strings.Split(imageName, "/")[1]
|
||||
imageName = strings.TrimPrefix(imageName, CmiiHarborPrefix)
|
||||
} else {
|
||||
|
||||
// todo
|
||||
if strings.Contains(imageName, "/") {
|
||||
imageName = strings.Split(imageName, "/")[1]
|
||||
}
|
||||
}
|
||||
|
||||
targetImageName := targetHarborHost + ":8033/" + targetProject + "/" + imageName
|
||||
@@ -209,7 +212,8 @@ func TagFromListAndPushToCHarbor(referenceImageList []string, targetHarborHost s
|
||||
pushResult := PushToOctopusKindHarbor(targetImageName)
|
||||
if pushResult == nil {
|
||||
errorPushImageNameList = append(errorPushImageNameList, cmiiImageFullName)
|
||||
continue
|
||||
log.InfoF("[ImageTagFromListAndPushToCHarbor] - push of %s error error !", targetImageName)
|
||||
break
|
||||
}
|
||||
scanner := bufio.NewScanner(pushResult)
|
||||
for scanner.Scan() {
|
||||
|
||||
Reference in New Issue
Block a user