use password push image

This commit is contained in:
凡羊羊 2020-04-15 18:24:20 +08:00
parent 1bcebb4a63
commit 2900dc1926

View File

@ -384,8 +384,18 @@ func (i *ImportApp) importPlugins() error {
return err
}
// 上传到仓库
user := plugin.Get("plugin_image.hub_user").String()
pass := plugin.Get("plugin_image.hub_password").String()
user := builder.REGISTRYUSER
hubUser := plugin.Get("plugin_image.hub_user").String()
if hubUser != "" {
logrus.Debugf("plugin image hub user is : %s", hubUser)
user = hubUser
}
pass := builder.REGISTRYPASS
hubPass := plugin.Get("plugin_image.hub_password").String()
if hubPass != "" {
logrus.Debugf("plugin image hub password is : %s", hubUser)
pass = hubPass
}
// 上传之前先要根据新的仓库地址修改镜像名
image := i.oldPluginPath[plugin.Get("plugin_id").String()]
imageName := sources.ImageNameWithNamespaceHandle(image)
@ -437,8 +447,18 @@ func (i *ImportApp) loadApps() error {
// 上传到仓库
oldImage := i.oldAPPPath[app.Get("service_key").String()]
oldImageName := sources.ImageNameWithNamespaceHandle(oldImage)
user := app.Get("service_image.hub_user").String()
pass := app.Get("service_image.hub_password").String()
user := builder.REGISTRYUSER
hubUser := app.Get("service_image.hub_user").String()
if hubUser != "" {
logrus.Debugf("app service image hub user is : %s", hubUser)
user = hubUser
}
pass := builder.REGISTRYPASS
hubPass := app.Get("service_image.hub_password").String()
if hubPass != "" {
logrus.Debugf("app service image hub password is : %s", hubPass)
pass = hubPass
}
// 上传之前先要根据新的仓库地址修改镜像名
image := app.Get("share_image").String()
if err := sources.ImageTag(i.DockerClient, fmt.Sprintf("%s/%s:%s", builder.REGISTRYDOMAIN, oldImageName.Name, oldImageName.Tag), image, i.Logger, 15); err != nil {