File tree 3 files changed +19
-14
lines changed
3 files changed +19
-14
lines changed Original file line number Diff line number Diff line change @@ -118,7 +118,7 @@ func (d *DockerBuilder) Build() error {
118
118
}
119
119
glog .V (0 ).Infof ("\n Pushing image %s ..." , pushTag )
120
120
if err := pushImage (d .dockerClient , pushTag , pushAuthConfig ); err != nil {
121
- return fmt . Errorf ( "Failed to push image: %v" , err )
121
+ return reportPushFailure ( err , authPresent , pushAuthConfig )
122
122
}
123
123
glog .V (0 ).Infof ("Push successful" )
124
124
}
Original file line number Diff line number Diff line change @@ -267,19 +267,7 @@ func (s *S2IBuilder) Build() error {
267
267
}
268
268
glog .V (0 ).Infof ("\n Pushing image %s ..." , pushTag )
269
269
if err := pushImage (s .dockerClient , pushTag , pushAuthConfig ); err != nil {
270
- // write extended error message to assist in problem resolution
271
- msg := fmt .Sprintf ("Failed to push image. Response from registry is: %v" , err )
272
- if authPresent {
273
- glog .V (0 ).Infof ("Registry server Address: %s" , pushAuthConfig .ServerAddress )
274
- glog .V (0 ).Infof ("Registry server User Name: %s" , pushAuthConfig .Username )
275
- glog .V (0 ).Infof ("Registry server Email: %s" , pushAuthConfig .Email )
276
- passwordPresent := "<<empty>>"
277
- if len (pushAuthConfig .Password ) > 0 {
278
- passwordPresent = "<<non-empty>>"
279
- }
280
- glog .V (0 ).Infof ("Registry server Password: %s" , passwordPresent )
281
- }
282
- return errors .New (msg )
270
+ return reportPushFailure (err , authPresent , pushAuthConfig )
283
271
}
284
272
glog .V (0 ).Infof ("Push successful" )
285
273
}
Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ import (
12
12
"strconv"
13
13
"strings"
14
14
15
+ docker "github.com/fsouza/go-dockerclient"
16
+
15
17
s2iapi "github.com/openshift/source-to-image/pkg/api"
16
18
)
17
19
@@ -175,3 +177,18 @@ func MergeEnv(oldEnv, newEnv []string) []string {
175
177
}
176
178
return result
177
179
}
180
+
181
+ func reportPushFailure (err error , authPresent bool , pushAuthConfig docker.AuthConfiguration ) error {
182
+ // write extended error message to assist in problem resolution
183
+ if authPresent {
184
+ glog .V (0 ).Infof ("Registry server Address: %s" , pushAuthConfig .ServerAddress )
185
+ glog .V (0 ).Infof ("Registry server User Name: %s" , pushAuthConfig .Username )
186
+ glog .V (0 ).Infof ("Registry server Email: %s" , pushAuthConfig .Email )
187
+ passwordPresent := "<<empty>>"
188
+ if len (pushAuthConfig .Password ) > 0 {
189
+ passwordPresent = "<<non-empty>>"
190
+ }
191
+ glog .V (0 ).Infof ("Registry server Password: %s" , passwordPresent )
192
+ }
193
+ return fmt .Errorf ("Failed to push image: %v" , err )
194
+ }
You can’t perform that action at this time.
0 commit comments