File tree Expand file tree Collapse file tree 1 file changed +19
-3
lines changed
Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -14,10 +14,12 @@ import (
1414 "github.com/docker/cli/cli-plugins/plugin"
1515 "github.com/docker/cli/cli/command"
1616 "github.com/docker/cli/cli/debug"
17- "github.com/moby/buildkit/solver/errdefs"
17+ solvererrdefs "github.com/moby/buildkit/solver/errdefs"
18+ "github.com/moby/buildkit/util/grpcerrors"
1819 "github.com/moby/buildkit/util/stack"
1920 "github.com/pkg/errors"
2021 "go.opentelemetry.io/otel"
22+ "google.golang.org/grpc/codes"
2123
2224 _ "k8s.io/client-go/plugin/pkg/client/auth/oidc"
2325
@@ -99,7 +101,7 @@ func main() {
99101 os .Exit (sterr .StatusCode )
100102 }
101103
102- for _ , s := range errdefs .Sources (err ) {
104+ for _ , s := range solvererrdefs .Sources (err ) {
103105 s .Print (cmd .Err ())
104106 }
105107 if debug .IsEnabled () {
@@ -113,5 +115,19 @@ func main() {
113115 ebr .Print (cmd .Err ())
114116 }
115117
116- os .Exit (1 )
118+ exitCode := 1
119+ switch grpcerrors .Code (err ) {
120+ case codes .Internal :
121+ exitCode = 100 // https://github.com/square/exit/blob/v1.3.0/exit.go#L70
122+ case codes .ResourceExhausted :
123+ exitCode = 102
124+ case codes .Canceled :
125+ exitCode = 130
126+ default :
127+ if errors .Is (err , context .Canceled ) {
128+ exitCode = 130
129+ }
130+ }
131+
132+ os .Exit (exitCode )
117133}
You can’t perform that action at this time.
0 commit comments