@@ -184,16 +184,8 @@ func (r *RootCmd) supportBundle() *serpent.Command {
184
184
_ = os .Remove (outputPath ) // best effort
185
185
return xerrors .Errorf ("create support bundle: %w" , err )
186
186
}
187
- docsURL := bun .Deployment .Config .Values .DocsURL .String ()
188
- deployHealthSummary := bun .Deployment .HealthReport .Summarize (docsURL )
189
- if len (deployHealthSummary ) > 0 {
190
- cliui .Warn (inv .Stdout , "Deployment health issues detected:" , deployHealthSummary ... )
191
- }
192
- clientNetcheckSummary := bun .Network .Netcheck .Summarize ("Client netcheck:" , docsURL )
193
- if len (clientNetcheckSummary ) > 0 {
194
- cliui .Warn (inv .Stdout , "Networking issues detected:" , deployHealthSummary ... )
195
- }
196
187
188
+ summarizeBundle (inv , bun )
197
189
bun .CLILogs = cliLogBuf .Bytes ()
198
190
199
191
if err := writeBundle (bun , zwr ); err != nil {
@@ -225,6 +217,41 @@ func (r *RootCmd) supportBundle() *serpent.Command {
225
217
return cmd
226
218
}
227
219
220
+ // summarizeBundle makes a best-effort attempt to write a short summary
221
+ // of the support bundle to the user's terminal.
222
+ func summarizeBundle (inv * serpent.Invocation , bun * support.Bundle ) {
223
+ if bun == nil {
224
+ cliui .Error (inv .Stdout , "No support bundle generated!" )
225
+ return
226
+ }
227
+
228
+ if bun .Deployment .Config == nil {
229
+ cliui .Error (inv .Stdout , "No deployment configuration available!" )
230
+ return
231
+ }
232
+
233
+ docsURL := bun .Deployment .Config .Values .DocsURL .String ()
234
+ if bun .Deployment .HealthReport == nil {
235
+ cliui .Error (inv .Stdout , "No deployment health report available!" )
236
+ return
237
+ }
238
+
239
+ deployHealthSummary := bun .Deployment .HealthReport .Summarize (docsURL )
240
+ if len (deployHealthSummary ) > 0 {
241
+ cliui .Warn (inv .Stdout , "Deployment health issues detected:" , deployHealthSummary ... )
242
+ }
243
+
244
+ if bun .Network .Netcheck == nil {
245
+ cliui .Error (inv .Stdout , "No network troubleshooting information available!" )
246
+ return
247
+ }
248
+
249
+ clientNetcheckSummary := bun .Network .Netcheck .Summarize ("Client netcheck:" , docsURL )
250
+ if len (clientNetcheckSummary ) > 0 {
251
+ cliui .Warn (inv .Stdout , "Networking issues detected:" , deployHealthSummary ... )
252
+ }
253
+ }
254
+
228
255
func findAgent (agentName string , haystack []codersdk.WorkspaceResource ) (* codersdk.WorkspaceAgent , bool ) {
229
256
for _ , res := range haystack {
230
257
for _ , agt := range res .Agents {
0 commit comments