[Cmii][ImageSync] - DCU part modified
This commit is contained in:
@@ -245,34 +245,29 @@ func TestUpdateCmiiDeploymentImageTag(t *testing.T) {
|
||||
|
||||
// 计算20:00的时间
|
||||
now := time.Now()
|
||||
targetTime := time.Date(now.Year(), now.Month(), now.Day(), 20, 0, 0, 0, now.Location())
|
||||
targetTime := time.Date(now.Year(), now.Month(), now.Day(), 16, 12, 0, 0, now.Location())
|
||||
|
||||
// 如果当前时间已经过了20:00,那么就跳到下一天
|
||||
if now.After(targetTime) {
|
||||
targetTime = targetTime.Add(24 * time.Hour)
|
||||
duration := time.Duration(0)
|
||||
|
||||
if !now.After(targetTime) {
|
||||
// 计算到20:00的剩余时间
|
||||
duration = targetTime.Sub(now)
|
||||
} else {
|
||||
// 如果当前时间已经过了20:00,那么就跳到下一天
|
||||
//targetTime = targetTime.Add(24 * time.Hour)
|
||||
}
|
||||
|
||||
// 计算到20:00的剩余时间
|
||||
duration := targetTime.Sub(now)
|
||||
fmt.Println(duration)
|
||||
|
||||
// 等待到20:00
|
||||
time.Sleep(duration)
|
||||
|
||||
cmiiEnv := demo
|
||||
cmiiEnv := devFlight
|
||||
//appName := "cmii-uav-platform"
|
||||
//newTag := "5.4.0-032601"
|
||||
|
||||
appNameTagMap := map[string]string{
|
||||
"cmii-uav-waypoint": "5.4.0-032901",
|
||||
"cmii-uav-platform-armypeople": "5.4.0-032901",
|
||||
"cmii-uav-platform-open": "5.4.0-032901",
|
||||
"cmii-admin-data": "5.4.0-032901",
|
||||
"cmii-uav-industrial-portfolio": "5.4.0-032901",
|
||||
"cmii-uav-mqtthandler": "5.4.0-032901",
|
||||
"cmii-uav-alarm": "5.4.0-032501",
|
||||
"cmii-uav-device": "5.4.0-032501",
|
||||
"cmii-suav-supervision": "5.4.0-032501",
|
||||
"cmii-uav-airspace": "5.4.0-032501",
|
||||
"cmii-uav-industrial-portfolio": "5.4.0-041001",
|
||||
}
|
||||
|
||||
for appName, newTag := range appNameTagMap {
|
||||
|
||||
@@ -21,9 +21,9 @@ type CmiiMinioOperator struct {
|
||||
}
|
||||
|
||||
const (
|
||||
DefaultLocalEndpoint = "http://10.250.0.100:9000"
|
||||
DefaultPublicEndpoint = "http://42.192.52.227:9000"
|
||||
DemoEndpoint = "https://oss.demo.uavcmlc.com:18000"
|
||||
DefaultLocalEndpoint = "10.250.0.100:9000"
|
||||
DefaultPublicEndpoint = "42.192.52.227:9000"
|
||||
DemoEndpoint = "oss.demo.uavcmlc.com:18000"
|
||||
DefaultAccessKeyID = "cmii"
|
||||
DefaultSecretAccessKey = "B#923fC7mk"
|
||||
DefaultOctopusBucketName = "octopus"
|
||||
@@ -50,7 +50,7 @@ func (op CmiiMinioOperator) buildCmiiMinioOperator() {
|
||||
|
||||
if op.DemoClient == nil {
|
||||
// 初始化Minio客户端对象。
|
||||
op.PublicClient, err = minio.New(DemoEndpoint, DefaultAccessKeyID, DefaultSecretAccessKey, false)
|
||||
op.DemoClient, err = minio.New(DemoEndpoint, DefaultAccessKeyID, DefaultSecretAccessKey, false)
|
||||
if err != nil {
|
||||
log.ErrorF("[buildCmiiMinioOperator] - build for DemoClient error ! => %s", err.Error())
|
||||
}
|
||||
@@ -73,7 +73,7 @@ func (op CmiiMinioOperator) UploadToPublicOctopus(filePath, fileName string) boo
|
||||
func (op CmiiMinioOperator) UploadToDemo(bucketName, filePath, fileName string) bool {
|
||||
|
||||
op.buildCmiiMinioOperator()
|
||||
return op.uploadToOss(op.PublicClient, bucketName, filePath, fileName)
|
||||
return op.uploadToOss(op.DemoClient, bucketName, filePath, fileName)
|
||||
}
|
||||
|
||||
func (op CmiiMinioOperator) uploadToOctopus(client *minio.Client, filePath, fileName string) bool {
|
||||
|
||||
@@ -58,14 +58,14 @@ func TestPullFromEntityAndSyncConditionally(t *testing.T) {
|
||||
ProjectVersion: "",
|
||||
DirectHarborHost: "",
|
||||
CompressImageToGzip: false,
|
||||
UploadToDemoMinio: false,
|
||||
UploadToDemoMinio: true,
|
||||
ShouldDirectPushToHarbor: false,
|
||||
}
|
||||
|
||||
// 调用函数并获取结果。这里需要根据你的实际需求来验证返回的结果是否符合预期。
|
||||
result := sync.PullFromEntityAndSyncConditionally()
|
||||
|
||||
utils.BeautifulPrint(sync)
|
||||
utils.BeautifulPrint(result)
|
||||
|
||||
// 添加断言以检查函数的输出,例如:
|
||||
if len(result.ErrorPullImageList) != 0 {
|
||||
|
||||
@@ -312,7 +312,7 @@ func PullCmiiFromFileJson(filePathName string) {
|
||||
func PullFromFullNameList(fullImageNameList []string) (errorPullImageList []string) {
|
||||
|
||||
for _, fullImageName := range fullImageNameList {
|
||||
|
||||
log.DebugF("start to pull => [%s]", fullImageName)
|
||||
pullResult := PullFromCmiiHarbor(fullImageName)
|
||||
if pullResult == nil {
|
||||
errorPullImageList = append(errorPullImageList, fullImageName)
|
||||
|
||||
Reference in New Issue
Block a user