-
Notifications
You must be signed in to change notification settings - Fork 248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: 创建前检测非模板配置和模板配置是否存在冲突 --bug=122816798 #3124
fix: 创建前检测非模板配置和模板配置是否存在冲突 --bug=122816798 #3124
Conversation
b756200
to
1a6c04a
Compare
8b3da64
to
b5f2c30
Compare
b5f2c30
to
d592912
Compare
fileDir = strings.Replace(path, rootDir, "", 1) | ||
fileDir = strings.ReplaceAll(fileDir, "\\", "/") | ||
lastSlashIndex := strings.LastIndex(fileDir, "/") | ||
if lastSlashIndex >= 0 { | ||
fileDir = fileDir[:lastSlashIndex] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里做的事情应该是以下几步吧:
- 获取相对路径
- 统一分隔符为 '/'
- 获取文件的父目录
可以直接用内置函数来解决,可读性比较强
fileDir = filepath.Rel(fileDir, path)
fileDir = strings.ReplaceAll(fileDir, "\\", "/")
fileDir = filepath.Dir(fileDir)
for _, v2 := range b { | ||
path2 := path.Join(v2.Path, v2.Name) | ||
if path1 == path2 { | ||
continue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
反了吧,应该是 path1 == path2 就直接报错冲突了吧
@@ -38,6 +39,20 @@ func (s *Service) CreateRelease(ctx context.Context, req *pbcs.CreateReleaseReq) | |||
return nil, err | |||
} | |||
|
|||
// 创建版本前验证非模板配置和模板配置是否存在冲突 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
在 GenerateReleaseAndPublish 接口也加上这个判断
// validate in table config_items | ||
if _, err := s.dao.ConfigItem().GetByUniqueKey(grpcKit, req.ConfigItemAttachment.BizId, | ||
req.ConfigItemAttachment.AppId, req.ConfigItemSpec.Name, req.ConfigItemSpec.Path); err == nil { | ||
if tools.CheckPathConflict(path.Join(req.ConfigItemSpec.Path, req.ConfigItemSpec.Name), existingPaths) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return | ||
} | ||
|
||
// 获取服务下某个空间下的所有套餐 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里应该是获取空间下的所有模板吧,和服务、套餐没关系
// getAllConfigFileByApp 获取服务下的配置项以及关联后的空间模板配置 | ||
func (c *configImport) getAllConfigFileByApp(kt *kit.Kit, newFiles []types.CIUniqueKey) error { | ||
// 获取服务下所有配置模板 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这两个注释都不对吧,这里应该是获取服务下的所有非模板配置
5060dc7
to
733aa86
Compare
733aa86
to
a4de386
Compare
* github-bk-bcs/master: fix: 客户端体验问题优化 (#3200) refactor: 文件型配置表格优化 (#3201) feat: 组件类型版本分布数据支持下钻 (#3197) refactor: 更新前端icon资源 (#3199) fix: 修复下载zip类型配置项文件损坏的问题 (#3198) fix: 客户端验收问题修复 (#3196) feature: 客户端事件列表支持时分秒搜索 (#3195) feat: 客户端统计新增在线/离线状态搜索 (#3194) fix: 修复数据下钻标签没加搜索 (#3193) fix: 修复客户端添加搜索条件时心跳时间被覆盖问题 (#3192) fix: 创建前检测非模板配置和模板配置是否存在冲突 (#3124) feat: 客户端统计新增多维度查询和下钻 (#3189) feat: 客户端统计补全下钻功能及验收问题修复 (#3188)
No description provided.