@@ -20,6 +20,8 @@ import (
20
20
"fmt"
21
21
"regexp"
22
22
23
+ "github.com/sirupsen/logrus"
24
+
23
25
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/config"
24
26
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/constants"
25
27
sErrors "github.com/GoogleContainerTools/skaffold/pkg/skaffold/errors"
@@ -38,14 +40,16 @@ const (
38
40
)
39
41
40
42
var (
41
- nilSuggestions = func (cfg interface {}) []* proto.Suggestion { return nil }
43
+ unknownProjectErr = fmt .Sprintf (".*(%s.* unknown: Project.*)" , PushImageErr )
44
+ nilSuggestions = func (cfg interface {}) []* proto.Suggestion { return nil }
42
45
// for testing
43
46
getConfigForCurrentContext = config .GetConfigForCurrentKubectx
44
47
problems = []sErrors.Problem {
45
48
{
46
49
Regexp : re (fmt .Sprintf (".*%s.* denied: .*" , PushImageErr )),
47
50
ErrCode : proto .StatusCode_BUILD_PUSH_ACCESS_DENIED ,
48
- Description : func (error ) string {
51
+ Description : func (err error ) string {
52
+ logrus .Tracef ("error building %s" , err )
49
53
return "Build Failed. No push access to specified image repository"
50
54
},
51
55
Suggestion : suggestBuildPushAccessDeniedAction ,
59
63
Suggestion : nilSuggestions ,
60
64
},
61
65
{
62
- Regexp : re (fmt .Sprintf (".*%s.* unknown: Project" , PushImageErr )),
63
- Description : func (error ) string {
64
- return "Build Failed"
66
+ Regexp : re (unknownProjectErr ),
67
+ Description : func (err error ) string {
68
+ logrus .Tracef ("error building %s" , err )
69
+ matchExp := re (unknownProjectErr )
70
+ if match := matchExp .FindStringSubmatch (err .Error ()); len (match ) >= 2 {
71
+ return fmt .Sprintf ("Build Failed. %s" , match [1 ])
72
+ }
73
+ return fmt .Sprintf ("Build Failed due to %s" , err )
65
74
},
66
75
ErrCode : proto .StatusCode_BUILD_PROJECT_NOT_FOUND ,
67
76
Suggestion : func (interface {}) []* proto.Suggestion {
75
84
Regexp : re (dockerConnectionFailed ),
76
85
ErrCode : proto .StatusCode_BUILD_DOCKER_DAEMON_NOT_RUNNING ,
77
86
Description : func (err error ) string {
87
+ logrus .Tracef ("error building %s" , err )
78
88
matchExp := re (dockerConnectionFailed )
79
89
if match := matchExp .FindStringSubmatch (err .Error ()); len (match ) >= 2 {
80
90
return fmt .Sprintf ("Build Failed. %s" , match [1 ])
0 commit comments