支持 gcr.io k8s.gcr.io registry.k8s.io quay.io ghcr.io 等镜像库
This commit is contained in:
parent
fd40b8282a
commit
6d2efe65e0
15
main.go
15
main.go
|
@ -97,6 +97,7 @@ func main() {
|
||||||
result := struct {
|
result := struct {
|
||||||
Success bool
|
Success bool
|
||||||
Registry string
|
Registry string
|
||||||
|
RegistryUser string
|
||||||
OriginImageName string
|
OriginImageName string
|
||||||
TargetImageName string
|
TargetImageName string
|
||||||
GhUser string
|
GhUser string
|
||||||
|
@ -105,6 +106,7 @@ func main() {
|
||||||
}{
|
}{
|
||||||
Success: err == nil,
|
Success: err == nil,
|
||||||
Registry: config.Registry,
|
Registry: config.Registry,
|
||||||
|
RegistryUser: config.RegistryUserName,
|
||||||
OriginImageName: originImageName,
|
OriginImageName: originImageName,
|
||||||
TargetImageName: targetImageName,
|
TargetImageName: targetImageName,
|
||||||
GhUser: *ghUser,
|
GhUser: *ghUser,
|
||||||
|
@ -117,7 +119,9 @@ func main() {
|
||||||
err = tmpl.Execute(&buf, &result)
|
err = tmpl.Execute(&buf, &result)
|
||||||
|
|
||||||
fmt.Println("添加 转换结果 Comment")
|
fmt.Println("添加 转换结果 Comment")
|
||||||
commentIssues(issue, cli, ctx, strings.ReplaceAll(buf.String(), "^", "`"))
|
res := buf.String()
|
||||||
|
|
||||||
|
commentIssues(issue, cli, ctx, strings.ReplaceAll(res, "^", "`"))
|
||||||
|
|
||||||
fmt.Println("添加 转换结果 Label")
|
fmt.Println("添加 转换结果 Label")
|
||||||
issuesAddLabels(issue, cli, ctx, result.Success)
|
issuesAddLabels(issue, cli, ctx, result.Success)
|
||||||
|
@ -128,9 +132,11 @@ func main() {
|
||||||
|
|
||||||
var resultTpl = `
|
var resultTpl = `
|
||||||
{{ if .Success }}
|
{{ if .Success }}
|
||||||
{{ if .Registry }}
|
|
||||||
**转换完成**
|
**转换完成**
|
||||||
^^^bash
|
^^^bash
|
||||||
|
{{ if .Registry }}
|
||||||
|
docker login -u{{ .RegistryUser }} {{ .Registry }}
|
||||||
|
{{ end }}
|
||||||
#原镜像
|
#原镜像
|
||||||
{{ .OriginImageName }}
|
{{ .OriginImageName }}
|
||||||
|
|
||||||
|
@ -146,7 +152,6 @@ docker tag {{ .TargetImageName }} {{ .originImageName }}
|
||||||
docker images | grep $(echo {{ .OriginImageName }} |awk -F':' '{print $1}')
|
docker images | grep $(echo {{ .OriginImageName }} |awk -F':' '{print $1}')
|
||||||
|
|
||||||
^^^
|
^^^
|
||||||
{{ end }}
|
|
||||||
{{ else }}
|
{{ else }}
|
||||||
**转换失败**
|
**转换失败**
|
||||||
详见 [构建任务](https://github.com/{{ .GhUser }}/{{ .Repo }}/actions/runs/{{ .RunId }})
|
详见 [构建任务](https://github.com/{{ .GhUser }}/{{ .Repo }}/actions/runs/{{ .RunId }})
|
||||||
|
@ -266,7 +271,9 @@ func dockerPush(targetImageName string, cli *client.Client, ctx context.Context,
|
||||||
authConfig := types.AuthConfig{
|
authConfig := types.AuthConfig{
|
||||||
Username: config.RegistryUserName,
|
Username: config.RegistryUserName,
|
||||||
Password: config.RegistryPassword,
|
Password: config.RegistryPassword,
|
||||||
ServerAddress: config.Registry,
|
}
|
||||||
|
if len(config.Registry) > 0 {
|
||||||
|
authConfig.ServerAddress = config.Registry
|
||||||
}
|
}
|
||||||
encodedJSON, err := json.Marshal(authConfig)
|
encodedJSON, err := json.Marshal(authConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue