Ignore if password is empty

Signed-off-by: Amine Chouki <amine.chouki@docker.com>
This commit is contained in:
Amine Chouki 2021-07-26 09:55:38 -04:00
parent b9f38feb25
commit 3f59e9a3ad
2 changed files with 8 additions and 0 deletions

View File

@ -65,6 +65,9 @@ func isUsingDefaultRegistry(cmdArgs []string) bool {
}
func isUsingPassword(pass string) bool {
if pass == "" { // ignore if no password (or SSO)
return false
}
if _, err := uuid.ParseUUID(pass); err == nil {
return false
}

View File

@ -74,6 +74,11 @@ func TestIsUsingPassword(t *testing.T) {
"mypass",
true,
},
{
"no password or sso",
"",
false,
},
{
"personal access token",
"1508b8bd-b80c-452d-9a7a-ee5607c41bcd",