镜像列表开发完成

Former-commit-id: 7ee7b0c5c4c5838ca0e5316427141579ab1b653e
This commit is contained in:
zhangwei 2023-07-10 17:27:02 +08:00
parent d51c5aed55
commit 976e9b2b09
1 changed files with 7 additions and 26 deletions

View File

@ -27,31 +27,12 @@ func NewImageListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ImageLi
}
func (l *ImageListLogic) ImageList() (resp *types.ImageListResp, err error) {
var images []string
l.svcCtx.DbEngin.Raw("select distinct name from file where kind = 'image'").Scan(&images)
// 获取镜像列表
//url := fmt.Sprintf("%s/repository/%s/v2/_catalog", l.svcCtx.Config.NexusUrl, "pcm")
//bytes, err := tool.HttpClient("GET", url, nil, "")
//json.Unmarshal(bytes, &resp)
//result := types.ImageListResp{}
//for _, image := range resp.Repositories {
// // 获取镜像的tag列表
// url := fmt.Sprintf("registry.cn-hangzhou.aliyuncs.com/jointcloud/pcm:", image)
// bytes, err := tool.HttpClient("GET", url, nil, "")
// if err != nil {
// return nil, err
// }
// tags := ImageTags{}
// json.Unmarshal(bytes, &tags)
// // 拼接镜像名称
// for _, tag := range tags.Tags {
// var name string
// if tag != "latest" {
// name = "hub.jcce.dev:18445/" + image + ":" + tag
// } else {
// name = "hub.jcce.dev:18445/" + image
// }
// result.Repositories = append(result.Repositories, name)
// }
//}
return nil, nil
result := types.ImageListResp{
Repositories: images,
}
return &result, nil
}