This commit is contained in:
yanweidong 2024-03-21 18:15:36 +08:00
parent 2b22041ed8
commit a893f6ac86
1 changed files with 24 additions and 10 deletions

View File

@ -55,10 +55,13 @@ func etcExecute(ls []LocalServices) {
for _, service := range ls {
yamlUrl := fmt.Sprintf("%s%s/%s/%s_%s.yaml", service.Srv.OssUrl, service.Srv.EtcPath, env.MeshEnv.Workspace, service.Srv.ServiceKey, env.MeshEnv.RuntimeMode)
body, err := utils.HttpGet(yamlUrl)
checkError(err)
fmt.Println("Check YAML Configure:", yamlUrl, " [OK]")
yamlPath := filepath.Join(env.MeshEnv.Prefix, service.Srv.EtcPath, fmt.Sprintf("%s_%s.yaml", service.Srv.ServiceKey, env.MeshEnv.RuntimeMode))
utils.StringToFile(yamlPath, string(body))
if err != nil {
fmt.Println("Check YAML Configure:", yamlUrl, " [ERROR]", err.Error())
} else {
fmt.Println("Check YAML Configure:", yamlUrl, " [OK]")
yamlPath := filepath.Join(env.MeshEnv.Prefix, service.Srv.EtcPath, fmt.Sprintf("%s_%s.yaml", service.Srv.ServiceKey, env.MeshEnv.RuntimeMode))
utils.StringToFile(yamlPath, string(body))
}
}
}
@ -66,15 +69,26 @@ func getLocalServices() []LocalServices {
reles := getRegistryReleases()
dirFs, err := os.ReadDir(env.MeshEnv.Prefix)
checkError(err)
ls := make([]LocalServices, 0)
for _, v := range dirFs {
version := getCurrentVersion(v.Name())
if version != " - " {
for _, srv := range reles.Data {
checkError(err)
for _, v := range reles.Data {
var check bool = false
for _, srv := range dirFs {
if v.ServiceKey == srv.Name() {
check = true
break
}
}
if check {
version := getCurrentVersion(v.ServiceKey)
if version != " - " {
ls = append(ls, LocalServices{
Srv: srv,
Srv: v,
LocalVersion: version,
})
}