Login before build on build-push
If the username and password is set then do the login before the build on build-push so that users can build using base images from a secure private registry. Signed-off-by: Nick Adcock <nick.adcock@docker.com>
This commit is contained in:
Родитель
776ef5a742
Коммит
5ebd304927
|
@ -8,12 +8,22 @@ import (
|
|||
)
|
||||
|
||||
func buildPush(cmd command.Runner) error {
|
||||
registry := options.GetRegistry()
|
||||
login, err := options.GetLoginOptions()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if login.Username != "" && login.Password != "" {
|
||||
if err := command.RunLogin(cmd, login, registry); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
github, err := options.GetGitHubOptions()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
registry := options.GetRegistry()
|
||||
tags, err := options.GetTags(registry, github)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -30,16 +40,6 @@ func buildPush(cmd command.Runner) error {
|
|||
if shouldPush, err := options.ShouldPush(); err != nil {
|
||||
return err
|
||||
} else if shouldPush {
|
||||
login, err := options.GetLoginOptions()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if login.Username != "" && login.Password != "" {
|
||||
if err := command.RunLogin(cmd, login, registry); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return command.RunPush(cmd, tags)
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче