|
|
@ -271,7 +271,7 @@ func (u *ImageService) ImagePull(req dto.ImagePull) (string, error) {
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return "", err
|
|
|
|
return "", err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
options := types.ImagePullOptions{}
|
|
|
|
options := image.PullOptions{}
|
|
|
|
if repo.Auth {
|
|
|
|
if repo.Auth {
|
|
|
|
authConfig := registry.AuthConfig{
|
|
|
|
authConfig := registry.AuthConfig{
|
|
|
|
Username: repo.Username,
|
|
|
|
Username: repo.Username,
|
|
|
@ -373,19 +373,17 @@ func (u *ImageService) ImagePush(req dto.ImagePush) (string, error) {
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return "", err
|
|
|
|
return "", err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
options := types.ImagePushOptions{}
|
|
|
|
options := image.PushOptions{All: true}
|
|
|
|
if repo.Auth {
|
|
|
|
authConfig := registry.AuthConfig{
|
|
|
|
authConfig := registry.AuthConfig{
|
|
|
|
Username: repo.Username,
|
|
|
|
Username: repo.Username,
|
|
|
|
Password: repo.Password,
|
|
|
|
Password: repo.Password,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
encodedJSON, err := json.Marshal(authConfig)
|
|
|
|
encodedJSON, err := json.Marshal(authConfig)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return "", err
|
|
|
|
return "", err
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
authStr := base64.URLEncoding.EncodeToString(encodedJSON)
|
|
|
|
|
|
|
|
options.RegistryAuth = authStr
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
authStr := base64.URLEncoding.EncodeToString(encodedJSON)
|
|
|
|
|
|
|
|
options.RegistryAuth = authStr
|
|
|
|
newName := fmt.Sprintf("%s/%s", repo.DownloadUrl, req.Name)
|
|
|
|
newName := fmt.Sprintf("%s/%s", repo.DownloadUrl, req.Name)
|
|
|
|
if newName != req.TagName {
|
|
|
|
if newName != req.TagName {
|
|
|
|
if err := client.ImageTag(context.TODO(), req.TagName, newName); err != nil {
|
|
|
|
if err := client.ImageTag(context.TODO(), req.TagName, newName); err != nil {
|
|
|
|