Skip to content

Commit d17d7ad

Browse files
print logs on deployment failures
1 parent 7300bdb commit d17d7ad

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

src/cmd/cli/command/compose.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,22 @@ func makeComposeUpCmd() *cobra.Command {
166166
serviceStates, err := cli.Monitor(ctx, project, provider, time.Duration(waitTimeout)*time.Second, deploy.Etag)
167167
if err != nil {
168168
deploymentErr := err
169+
// TODO: only show the most relevant logs:
170+
// * avoid showing service logs if the failure was during the build stage
171+
// * avoid showing build logs for services that built successfully
172+
// * only show cd logs if the failure was during deployment
173+
err := cli.Tail(ctx, provider, project.Name, cli.TailOptions{
174+
Deployment: deploy.Etag,
175+
LogType: logs.LogTypeAll,
176+
Since: since,
177+
Verbose: true,
178+
Follow: false,
179+
})
180+
if err != nil && !errors.Is(err, io.EOF) {
181+
term.Warn("Failed to tail logs for deployment error", err)
182+
return deploymentErr
183+
}
184+
169185
debugger, err := debug.NewDebugger(ctx, global.Cluster, &global.Stack)
170186
if err != nil {
171187
term.Warn("Failed to initialize debugger:", err)

0 commit comments

Comments
 (0)