File tree Expand file tree Collapse file tree 3 files changed +40
-0
lines changed
Expand file tree Collapse file tree 3 files changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -107,6 +107,10 @@ func (d *KoolDeploy) Execute(args []string) (err error) {
107107 d .Shell ().Info (" > Build deploy image for service: " , svcName )
108108
109109 if err = cloud .BuildPushImageForDeploy (svcName , svc , deployCreated ); err != nil {
110+ if reportErr := deployer .BuildError (deployCreated , err ); reportErr != nil {
111+ d .Shell ().Error (fmt .Errorf ("error reporting build error: %v" , reportErr ))
112+ }
113+
110114 return
111115 }
112116
Original file line number Diff line number Diff line change 1+ package api
2+
3+ import "fmt"
4+
5+ // DeployError consumes the API endpoint to inform a build error for a deployment
6+ type DeployError struct {
7+ Endpoint
8+ }
9+
10+ // NewDeployError creates a new DeployError instance
11+ func NewDeployError (created * DeployCreateResponse , err error ) (c * DeployError ) {
12+ c = & DeployError {
13+ Endpoint : NewDefaultEndpoint ("POST" ),
14+ }
15+
16+ c .SetPath ("deploy/error" )
17+ c .Body ().Set ("id" , fmt .Sprintf ("%d" , created .Deploy .ID ))
18+ c .Body ().Set ("err" , err .Error ())
19+
20+ return
21+ }
22+
23+ // Run calls deploy/error in the Kool Dev API
24+ func (c * DeployError ) Run () (err error ) {
25+ var resp interface {}
26+ c .SetResponseReceiver (& resp )
27+ err = c .DoCall ()
28+ return
29+ }
Original file line number Diff line number Diff line change @@ -43,3 +43,10 @@ func (d *Deployer) StartDeploy(created *api.DeployCreateResponse) (started *api.
4343 started , err = start .Run ()
4444 return
4545}
46+
47+ func (d * Deployer ) BuildError (created * api.DeployCreateResponse , gotErr error ) (err error ) {
48+ var buildErr = api .NewDeployError (created , gotErr )
49+
50+ err = buildErr .Run ()
51+ return
52+ }
You can’t perform that action at this time.
0 commit comments