From 72ef7b1f3fa6c47c58f33ca312bdc8c484b6c5a4 Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Mon, 2 Aug 2021 22:15:39 -0400 Subject: [PATCH] log available credentials before login --- docker.go | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/docker.go b/docker.go index 08dff98..9effe4c 100644 --- a/docker.go +++ b/docker.go @@ -93,7 +93,20 @@ func (p Plugin) Exec() error { time.Sleep(time.Second * 1) } - // Create Auth Config File + // for debugging purposes, log the type of authentication + // credentials that have been provided. + switch { + case p.Login.Password != "" && p.Login.Config != "": + fmt.Println("Detected registry credentials and registry credentials file") + case p.Login.Password != "": + fmt.Println("Detected registry credentials") + case p.Login.Config != "": + fmt.Println("Detected registry credentials file") + default: + fmt.Println("Registry credentials or Docker config not provided. Guest mode enabled.") + } + + // create Auth Config File if p.Login.Config != "" { os.MkdirAll(dockerHome, 0600) @@ -116,15 +129,6 @@ func (p Plugin) Exec() error { } } - switch { - case p.Login.Password != "": - fmt.Println("Detected registry credentials") - case p.Login.Config != "": - fmt.Println("Detected registry credentials file") - default: - fmt.Println("Registry credentials or Docker config not provided. Guest mode enabled.") - } - if p.Build.Squash && !p.Daemon.Experimental { fmt.Println("Squash build flag is only available when Docker deamon is started with experimental flag. Ignoring...") p.Build.Squash = false