Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2020fengziyang
kubesphere
提交
61a990c7
K
kubesphere
项目概览
2020fengziyang
/
kubesphere
与 Fork 源项目一致
Fork自
KubeSphere / kubesphere
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
kubesphere
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
61a990c7
编写于
3月 31, 2021
作者:
L
LiHui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix: update repo
Signed-off-by:
N
LiHui
<
andrewli@yunify.com
>
上级
2ae3823a
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
18 addition
and
16 deletion
+18
-16
pkg/kapis/openpitrix/v1/handler.go
pkg/kapis/openpitrix/v1/handler.go
+5
-1
pkg/models/openpitrix/repos.go
pkg/models/openpitrix/repos.go
+7
-13
pkg/models/openpitrix/types.go
pkg/models/openpitrix/types.go
+2
-2
pkg/models/openpitrix/utils.go
pkg/models/openpitrix/utils.go
+4
-0
未找到文件。
pkg/kapis/openpitrix/v1/handler.go
浏览文件 @
61a990c7
...
...
@@ -218,7 +218,11 @@ func (h *openpitrixHandler) DescribeRepo(req *restful.Request, resp *restful.Res
if
err
!=
nil
{
klog
.
Errorln
(
err
)
handleOpenpitrixError
(
resp
,
err
)
if
apierrors
.
IsNotFound
(
err
)
{
api
.
HandleNotFound
(
resp
,
nil
,
err
)
return
}
api
.
HandleInternalError
(
resp
,
nil
,
err
)
return
}
...
...
pkg/models/openpitrix/repos.go
浏览文件 @
61a990c7
...
...
@@ -20,7 +20,6 @@ import (
"sort"
"strings"
"github.com/go-openapi/strfmt"
apierrors
"k8s.io/apimachinery/pkg/api/errors"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
...
...
@@ -160,7 +159,8 @@ func (c *repoOperator) ModifyRepo(id string, request *ModifyRepoRequest) error {
repoCopy
.
Spec
.
Description
=
stringutils
.
ShortenString
(
*
request
.
Description
,
DescriptionLen
)
}
if
request
.
Name
!=
nil
&&
len
(
*
request
.
Name
)
>
0
&&
*
request
.
Name
!=
repoCopy
.
Name
{
// modify name of the repo
if
request
.
Name
!=
nil
&&
len
(
*
request
.
Name
)
>
0
&&
*
request
.
Name
!=
repoCopy
.
Spec
.
Name
{
items
,
err
:=
c
.
repoLister
.
List
(
labels
.
SelectorFromSet
(
map
[
string
]
string
{
constants
.
WorkspaceLabelKey
:
repo
.
GetWorkspace
()}))
if
err
!=
nil
&&
!
apierrors
.
IsNotFound
(
err
)
{
klog
.
Errorf
(
"list helm repo failed: %s"
,
err
)
...
...
@@ -207,10 +207,12 @@ func (c *repoOperator) ModifyRepo(id string, request *ModifyRepoRequest) error {
repoCopy
.
Spec
.
Credential
=
*
cred
repoCopy
.
Spec
.
Url
=
parsedUrl
.
String
()
// change repo name and description won't change version
repoCopy
.
Spec
.
Version
+=
1
}
patch
:=
client
.
MergeFrom
(
repo
)
repoCopy
.
Spec
.
Version
+=
1
data
,
err
:=
patch
.
Data
(
repoCopy
)
if
err
!=
nil
{
klog
.
Error
(
"create patch failed"
,
err
)
...
...
@@ -238,16 +240,8 @@ func (c *repoOperator) DescribeRepo(id string) (*Repo, error) {
return
nil
,
err
}
var
desRepo
Repo
desRepo
.
URL
=
repo
.
Spec
.
Url
desRepo
.
Description
=
repo
.
Spec
.
Description
desRepo
.
Name
=
repo
.
GetTrueName
()
desRepo
.
RepoId
=
repo
.
Name
dt
,
_
:=
strfmt
.
ParseDateTime
(
repo
.
CreationTimestamp
.
String
())
desRepo
.
CreateTime
=
&
dt
return
&
desRepo
,
nil
retRepo
:=
convertRepo
(
repo
)
return
retRepo
,
nil
}
func
(
c
*
repoOperator
)
ListRepos
(
conditions
*
params
.
Conditions
,
orderBy
string
,
reverse
bool
,
limit
,
offset
int
)
(
*
models
.
PageableResponse
,
error
)
{
...
...
pkg/models/openpitrix/types.go
浏览文件 @
61a990c7
...
...
@@ -690,8 +690,8 @@ type Repo struct {
// repository name
Name
string
`json:"name,omitempty"`
//
owne
r
Owner
string
`json:"owne
r,omitempty"`
//
creato
r
Creator
string
`json:"creato
r,omitempty"`
// runtime provider eg.[qingcloud|aliyun|aws|kubernetes]
Providers
[]
string
`json:"providers"`
...
...
pkg/models/openpitrix/utils.go
浏览文件 @
61a990c7
...
...
@@ -407,6 +407,10 @@ func convertRepo(in *v1alpha1.HelmRepo) *Repo {
out
.
CreateTime
=
&
date
out
.
Description
=
in
.
Spec
.
Description
out
.
Creator
=
in
.
GetCreator
()
cred
,
_
:=
json
.
Marshal
(
in
.
Spec
.
Credential
)
out
.
Credential
=
string
(
cred
)
out
.
URL
=
in
.
Spec
.
Url
return
&
out
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录