Skip to content

Commit

Permalink
log available credentials before login
Browse files Browse the repository at this point in the history
  • Loading branch information
bradrydzewski committed Aug 3, 2021
1 parent fbbeec5 commit 72ef7b1
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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
Expand Down

0 comments on commit 72ef7b1

Please sign in to comment.