feat: add agent log streaming and follow provisioner format (#8170)

This commit is contained in:
Mathias Fredriksson
2023-06-28 10:54:13 +02:00
committed by GitHub
parent c0a01ec81c
commit d3c39b60c9
9 changed files with 721 additions and 617 deletions
+2 -9
View File
@@ -176,23 +176,16 @@ func (r *RootCmd) ssh() *clibase.Cmd {
// OpenSSH passes stderr directly to the calling TTY.
// This is required in "stdio" mode so a connecting indicator can be displayed.
err = cliui.Agent(ctx, inv.Stderr, cliui.AgentOptions{
WorkspaceName: workspace.Name,
Fetch: func(ctx context.Context) (codersdk.WorkspaceAgent, error) {
return client.WorkspaceAgent(ctx, workspaceAgent.ID)
},
Wait: wait,
FetchLogs: client.WorkspaceAgentStartupLogsAfter,
Wait: wait,
})
if err != nil {
if xerrors.Is(err, context.Canceled) {
return cliui.Canceled
}
if !xerrors.Is(err, cliui.AgentStartError) {
return xerrors.Errorf("await agent: %w", err)
}
// We don't want to fail on a startup script error because it's
// natural that the user will want to fix the script and try again.
// We don't print the error because cliui.Agent does that for us.
}
if r.disableDirect {