Merge remote-tracking branch 'origin/local-ss' into local-ss
This commit is contained in:
@@ -2,9 +2,8 @@
|
||||
<configuration default="false" name="agent-go main" type="GoApplicationRunConfiguration"
|
||||
factoryName="Go Application">
|
||||
<module name="ProjectOctopus"/>
|
||||
<target name="LapPro-10.250.0.100"/>
|
||||
<working_directory value="$PROJECT_DIR$/agent-go"/>
|
||||
<parameters value="-age"/>
|
||||
<parameters value="-version=dev"/>
|
||||
<kind value="PACKAGE"/>
|
||||
<package value="wdd.io/agent-go"/>
|
||||
<directory value="$PROJECT_DIR$"/>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"time"
|
||||
)
|
||||
@@ -15,3 +16,36 @@ func GenerateRandomString(length int) string {
|
||||
}
|
||||
return string(b)
|
||||
}
|
||||
|
||||
func ByteSizeToString(size uint64) string {
|
||||
const (
|
||||
B = 1
|
||||
KB = 1024 * B
|
||||
MB = 1024 * KB
|
||||
GB = 1024 * MB
|
||||
TB = 1024 * GB
|
||||
)
|
||||
|
||||
var unit string
|
||||
var value float64
|
||||
|
||||
switch {
|
||||
case size >= TB:
|
||||
value = float64(size) / TB
|
||||
unit = "TB"
|
||||
case size >= GB:
|
||||
value = float64(size) / GB
|
||||
unit = "GB"
|
||||
case size >= MB:
|
||||
value = float64(size) / MB
|
||||
unit = "MB"
|
||||
case size >= KB:
|
||||
value = float64(size) / KB
|
||||
unit = "KB"
|
||||
default:
|
||||
value = float64(size)
|
||||
unit = "B"
|
||||
}
|
||||
|
||||
return fmt.Sprintf("%.2f %s", value, unit)
|
||||
}
|
||||
|
||||
@@ -254,14 +254,14 @@ func refreshAgentInfoByStatusInfo(agentInfo *a_status.AgentInfo, agentServerInfo
|
||||
// cpu part
|
||||
agentServerInfo.CPUCore = strconv.FormatInt(int64(agentInfo.CPUInfo.NumCores), 10)
|
||||
if len(agentInfo.CPUInfo.CPUInfo) > 0 {
|
||||
marshal, _ := json.Marshal(agentInfo.CPUInfo.CPUInfo[0])
|
||||
marshal, _ := json.Marshal(agentInfo.CPUInfo.CPUInfo[0].ModelName)
|
||||
agentServerInfo.CPUBrand = string(marshal)
|
||||
}
|
||||
|
||||
// os info
|
||||
agentServerInfo.OSInfo = agentInfo.HostInfo.PlatformFamily + agentInfo.HostInfo.Platform + agentInfo.HostInfo.PlatformVersion
|
||||
agentServerInfo.OSInfo = agentInfo.HostInfo.PlatformFamily + " " + agentInfo.HostInfo.Platform + " " + agentInfo.HostInfo.PlatformVersion
|
||||
agentServerInfo.OSKernelInfo = agentInfo.HostInfo.KernelVersion
|
||||
agentServerInfo.Virtualization = agentInfo.HostInfo.VirtualizationSystem + agentInfo.HostInfo.VirtualizationRole
|
||||
agentServerInfo.Virtualization = agentInfo.HostInfo.VirtualizationSystem + " " + agentInfo.HostInfo.VirtualizationRole
|
||||
agentServerInfo.Platform = agentInfo.HostInfo.Platform
|
||||
agentServerInfo.PlatformFamily = agentInfo.HostInfo.PlatformFamily
|
||||
agentServerInfo.PlatformVersion = agentInfo.HostInfo.PlatformVersion
|
||||
@@ -269,8 +269,8 @@ func refreshAgentInfoByStatusInfo(agentInfo *a_status.AgentInfo, agentServerInfo
|
||||
agentServerInfo.KernelArch = agentInfo.HostInfo.KernelArch
|
||||
|
||||
// memory part
|
||||
agentServerInfo.MemoryTotal = strconv.FormatInt(int64(agentInfo.MemoryInfo.TotalMemory), 10)
|
||||
agentServerInfo.SwapTotal = strconv.FormatInt(int64(agentInfo.MemoryInfo.SwapTotal), 10)
|
||||
agentServerInfo.MemoryTotal = utils.ByteSizeToString(agentInfo.MemoryInfo.TotalMemory)
|
||||
agentServerInfo.SwapTotal = utils.ByteSizeToString(agentInfo.MemoryInfo.SwapTotal)
|
||||
|
||||
// disk part
|
||||
info := agentInfo.DiskInfo
|
||||
@@ -283,8 +283,8 @@ func refreshAgentInfoByStatusInfo(agentInfo *a_status.AgentInfo, agentServerInfo
|
||||
diskUsage = diskInfo.Used
|
||||
}
|
||||
}
|
||||
agentServerInfo.DiskTotal = strconv.FormatUint(diskTotal, 10)
|
||||
agentServerInfo.DiskUsage = strconv.FormatUint(diskUsage, 10)
|
||||
agentServerInfo.DiskTotal = utils.ByteSizeToString(diskTotal)
|
||||
agentServerInfo.DiskUsage = utils.ByteSizeToString(diskUsage)
|
||||
|
||||
// network part
|
||||
refreshAgentNetworkInfo(agentInfo, agentServerInfo)
|
||||
|
||||
@@ -252,7 +252,7 @@ func TestUpdateCmiiDeploymentImageTag(t *testing.T) {
|
||||
|
||||
// 计算20:00的时间
|
||||
now := time.Now()
|
||||
targetTime := time.Date(now.Year(), now.Month(), now.Day(), 17, 45, 00, 0, now.Location())
|
||||
targetTime := time.Date(now.Year(), now.Month(), now.Day(), 12, 03, 00, 0, now.Location())
|
||||
|
||||
duration := time.Duration(0)
|
||||
|
||||
@@ -275,7 +275,10 @@ func TestUpdateCmiiDeploymentImageTag(t *testing.T) {
|
||||
|
||||
appNameTagMap := map[string]string{
|
||||
//"cmii-uav-multilink": "5.5.0",
|
||||
"cmii-uav-data-post-process": "5.5.0-042501",
|
||||
"cmii-uav-platform-cms-portal": "5.5.0-042801",
|
||||
"cmii-uav-platform": "5.5.0-042801",
|
||||
"cmii-uav-platform-oms": "5.5.0-042801",
|
||||
"cmii-uav-user": "5.5.0-042801",
|
||||
}
|
||||
|
||||
for appName, newTag := range appNameTagMap {
|
||||
|
||||
@@ -21,3 +21,8 @@
|
||||
2024-04-25-17-42-00 uavcloud-demo cmii-uav-platform 5.5.0-042501 5.5.0-042503
|
||||
2024-04-25-17-42-06 uavcloud-demo cmii-uav-platform-splice 5.5.0 5.5.0-042501
|
||||
2024-04-25-17-45-00 uavcloud-demo cmii-uav-data-post-process 5.5.0 5.5.0-042501
|
||||
2024-04-26-17-55-00 uavcloud-demo cmii-uav-platform-splice 5.5.0-042501 5.5.0-042601
|
||||
2024-04-28-12-03-00 uavcloud-demo cmii-uav-platform-cms-portal 5.5.0 5.5.0-042801
|
||||
2024-04-28-12-03-05 uavcloud-demo cmii-uav-platform 5.5.0-042503 5.5.0-042801
|
||||
2024-04-28-12-03-10 uavcloud-demo cmii-uav-platform-oms 5.5.0 5.5.0-042801
|
||||
2024-04-28-12-03-13 uavcloud-demo cmii-uav-user 5.5.0 5.5.0-042801
|
||||
|
||||
Reference in New Issue
Block a user