feat(cli): add support cmd (#12328)

Part of #12163

- Adds a command coder support bundle <workspace> that generates a 
  support bundle and writes it to coder-support-$(date +%s).zip.
- Note: this is hidden currently until the rest of the functionality is fleshed out.
This commit is contained in:
Cian Johnston
2024-03-01 17:13:50 +00:00
committed by GitHub
parent e5d911462f
commit b1c2fea78b
4 changed files with 400 additions and 1 deletions
+7 -1
View File
@@ -155,7 +155,13 @@ func WorkspaceInfo(ctx context.Context, client *codersdk.Client, log slog.Logger
return w
}
agt, err := client.WorkspaceAgent(ctx, agentID)
if err != nil {
log.Error(ctx, "fetch workspace agent", slog.Error(err), slog.F("agent_id", agentID))
}
w.Workspace = ws
w.Agent = agt
buildLogCh, closer, err := client.WorkspaceBuildLogsAfter(ctx, ws.LatestBuild.ID, 0)
if err != nil {
@@ -203,7 +209,7 @@ func Run(ctx context.Context, d *Deps) (*Bundle, error) {
// Ensure we capture logs from the client.
var logw strings.Builder
d.Log.AppendSinks(sloghuman.Sink(&logw))
d.Log = d.Log.AppendSinks(sloghuman.Sink(&logw))
d.Client.SetLogger(d.Log)
defer func() {
b.Logs = strings.Split(logw.String(), "\n")