提交 f3787e58 编写于 作者: 徐晓伟's avatar 徐晓伟

容器仓库 API: 删除仓库里存储库的某个标签

上级 44b13338
......@@ -231,10 +231,11 @@ COPYRIGHT:
gitlab-go container-registry command [command options] [arguments...]
COMMANDS:
list 列出仓库内存储库
list-tags 列出仓库里存储库的标签
get-tag 获取仓库里存储库的某个标签的详情
help, h Shows a list of commands or help for one command
list 列出仓库内存储库
list-tags 列出仓库里存储库的标签
get-tag 获取仓库里存储库的某个标签的详情
delete-tag, rm-tag 删除仓库里存储库的某个标签
help, h Shows a list of commands or help for one command
OPTIONS:
--base-url value 实例地址,例如:https://gitlab.xuxiaowei.com.cn/api/v4 (default: "https://gitlab.com/api/v4") [%CI_API_V4_URL%]
......
......@@ -261,6 +261,33 @@ func ContainerRegistry() *cli.Command {
}
}
return nil
},
},
{
Name: "delete-tag",
Aliases: []string{"rm-tag"},
Usage: "删除仓库里存储库的某个标签",
Flags: append(flag.CommonTokenRequired(),
flag.Id(true), flag.Repository(true), flag.TagName(true)),
Action: func(context *cli.Context) error {
var baseUrl = context.String(constant.BaseUrl)
var token = context.String(constant.Token)
var id = context.String(constant.Id)
var repository = context.Int(constant.Repository)
var tagName = context.String(constant.TagName)
gitClient, err := gitlab.NewClient(token, gitlab.WithBaseURL(baseUrl))
if err != nil {
return err
}
response, err := gitClient.ContainerRegistry.DeleteRegistryRepositoryTag(id, repository, tagName)
log.Printf("Response StatusCode: %d\n", response.Response.StatusCode)
if err != nil {
return err
}
return nil
},
},
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册