Skip to content

Commit 72ef7b1

Browse files
committed
log available credentials before login
1 parent fbbeec5 commit 72ef7b1

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

docker.go

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,20 @@ func (p Plugin) Exec() error {
9393
time.Sleep(time.Second * 1)
9494
}
9595

96-
// Create Auth Config File
96+
// for debugging purposes, log the type of authentication
97+
// credentials that have been provided.
98+
switch {
99+
case p.Login.Password != "" && p.Login.Config != "":
100+
fmt.Println("Detected registry credentials and registry credentials file")
101+
case p.Login.Password != "":
102+
fmt.Println("Detected registry credentials")
103+
case p.Login.Config != "":
104+
fmt.Println("Detected registry credentials file")
105+
default:
106+
fmt.Println("Registry credentials or Docker config not provided. Guest mode enabled.")
107+
}
108+
109+
// create Auth Config File
97110
if p.Login.Config != "" {
98111
os.MkdirAll(dockerHome, 0600)
99112

@@ -116,15 +129,6 @@ func (p Plugin) Exec() error {
116129
}
117130
}
118131

119-
switch {
120-
case p.Login.Password != "":
121-
fmt.Println("Detected registry credentials")
122-
case p.Login.Config != "":
123-
fmt.Println("Detected registry credentials file")
124-
default:
125-
fmt.Println("Registry credentials or Docker config not provided. Guest mode enabled.")
126-
}
127-
128132
if p.Build.Squash && !p.Daemon.Experimental {
129133
fmt.Println("Squash build flag is only available when Docker deamon is started with experimental flag. Ignoring...")
130134
p.Build.Squash = false

0 commit comments

Comments
 (0)