Skip to content

[support bundle] Add health checks to support bundles #8102

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 59 commits into from
May 14, 2025
Merged
Show file tree
Hide file tree
Changes from 53 commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
07dd473
[nexus] Put support bundles in internal API too
smklein Apr 11, 2025
c079c3f
[omdb] Basic commands to access support bundles
smklein Apr 14, 2025
df47341
Updated output
smklein Apr 14, 2025
219d284
Merge branch 'main' into sb-internal-api
smklein Apr 14, 2025
e39785a
Merge branch 'sb-internal-api' into omdb-sb
smklein Apr 14, 2025
12f461b
[nexus] Make it 'more default' for Debug datasets to exist in test en…
smklein Apr 15, 2025
1af91c6
test patching
smklein Apr 15, 2025
8969fbe
Merge branch 'main' into sb-internal-api
smklein Apr 15, 2025
3dfd8ab
Merge branch 'sb-internal-api' into omdb-sb
smklein Apr 15, 2025
07de40c
Merge branch 'omicron-dev-disk-test' into sb-internal-api
smklein Apr 15, 2025
4bf9d9a
Merge branch 'sb-internal-api' into omdb-sb
smklein Apr 15, 2025
73b4975
Try compiling
smklein Apr 15, 2025
c3876e2
Merge branch 'omicron-dev-disk-test' into sb-internal-api
smklein Apr 15, 2025
600a537
Merge branch 'sb-internal-api' into omdb-sb
smklein Apr 15, 2025
8022e12
Use internal opctx
smklein Apr 15, 2025
47819c0
Patching tests more
smklein Apr 15, 2025
78af872
Merge branch 'omicron-dev-disk-test' into sb-internal-api
smklein Apr 15, 2025
192e255
Merge branch 'sb-internal-api' into omdb-sb
smklein Apr 15, 2025
6374a7b
Don't inject newlines
smklein Apr 16, 2025
c28a398
Continuing to iterate on TUI
smklein Apr 23, 2025
ab14729
Merge branch 'main' into omicron-dev-disk-test
smklein Apr 23, 2025
ceedbc3
Merge branch 'omicron-dev-disk-test' into sb-internal-api
smklein Apr 23, 2025
8278c09
Merge branch 'sb-internal-api' into omdb-sb
smklein Apr 23, 2025
9070654
Merge branch 'omdb-sb' into omdb-sb-polish
smklein Apr 23, 2025
820556f
Shift to move faster, fix dirs, wrapping
smklein Apr 23, 2025
0a457dd
Enable inspection of local files
smklein Apr 24, 2025
7fe5002
Fmt
smklein Apr 24, 2025
7fb1168
Merge branch 'main' into omicron-dev-disk-test
smklein Apr 25, 2025
36d2d04
Make datasets private, add helpers to access them
smklein Apr 25, 2025
bcfbb51
Merge branch 'omicron-dev-disk-test' into sb-internal-api
smklein Apr 25, 2025
b21b525
feedback
smklein Apr 25, 2025
b9b94d5
Merge branch 'sb-internal-api' into omdb-sb
smklein Apr 25, 2025
53c0a76
feedback, less utf8
smklein Apr 25, 2025
8f75399
Merge branch 'omdb-sb' into omdb-sb-polish
smklein Apr 25, 2025
44bd6a5
Better support for binary files
smklein Apr 25, 2025
9597433
Merge branch 'main' into omicron-dev-disk-test
smklein Apr 28, 2025
d2d0c76
Merge branch 'omicron-dev-disk-test' into sb-internal-api
smklein Apr 28, 2025
c8d9546
Merge branch 'sb-internal-api' into omdb-sb
smklein Apr 28, 2025
2790d9a
expectorate
smklein Apr 28, 2025
1a218b8
Merge branch 'omdb-sb' into omdb-sb-polish
smklein Apr 28, 2025
b73b6ff
Better support for waiting for collection to finish
smklein Apr 29, 2025
82ca320
Refactoring TUI into support-bundle-reader-lib
smklein Apr 29, 2025
995ca46
More private interface
smklein Apr 29, 2025
6ad1a31
starting to buffer and stream more properly
smklein Apr 30, 2025
865467a
Less unwrapping, more cleanup
smklein Apr 30, 2025
cc94a11
Merge branch 'main' into omdb-sb-polish
smklein Apr 30, 2025
f2aae61
[omdb] Add command to download entire support bundle
smklein Apr 30, 2025
70a9518
[support bundle] Add health checks to support bundles
smklein May 6, 2025
bf76518
Merge branch 'main' into omdb-sb-polish
smklein May 7, 2025
12d00d8
feedback
smklein May 7, 2025
3ac4d4c
Merge branch 'omdb-sb-polish' into omdb-sb-download-whole-thing
smklein May 7, 2025
6e57da6
Merge branch 'omdb-sb-download-whole-thing' into sb-health-check
smklein May 7, 2025
b2522d1
feedback
smklein May 7, 2025
3946a67
Merge branch 'main' into omdb-sb-polish
smklein May 7, 2025
531ad3a
Merge branch 'omdb-sb-polish' into omdb-sb-download-whole-thing
smklein May 7, 2025
160bdb0
Merge branch 'omdb-sb-download-whole-thing' into sb-health-check
smklein May 7, 2025
4538d70
Merge branch 'main' into omdb-sb-download-whole-thing
smklein May 8, 2025
63ef90c
Merge branch 'omdb-sb-download-whole-thing' into sb-health-check
smklein May 8, 2025
5e3cf04
avoid linebreaks
smklein May 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ members = [
"dev-tools/releng",
"dev-tools/repl-utils",
"dev-tools/repo-depot-standalone",
"dev-tools/support-bundle-reader-lib",
"dev-tools/xtask",
"dns-server",
"dns-server-api",
Expand Down Expand Up @@ -199,6 +200,7 @@ default-members = [
"dev-tools/releng",
"dev-tools/repl-utils",
"dev-tools/repo-depot-standalone",
"dev-tools/support-bundle-reader-lib",
# Do not include xtask in the list of default members, because this causes
# hakari to not work as well and build times to be longer.
# See omicron#4392.
Expand Down Expand Up @@ -692,6 +694,7 @@ strum = { version = "0.26", features = [ "derive" ] }
subprocess = "0.2.9"
subtle = "2.6.1"
supports-color = "3.0.2"
support-bundle-reader-lib = { path = "dev-tools/support-bundle-reader-lib" }
swrite = "0.1.0"
sync-ptr = "0.1.1"
libsw = { version = "3.4.0", features = ["tokio"] }
Expand Down
1 change: 1 addition & 0 deletions dev-tools/omdb/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ slog.workspace = true
slog-error-chain.workspace = true
steno.workspace = true
strum.workspace = true
support-bundle-reader-lib.workspace = true
supports-color.workspace = true
tabled.workspace = true
textwrap.workspace = true
Expand Down
74 changes: 73 additions & 1 deletion dev-tools/omdb/src/bin/omdb/nexus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -495,19 +495,33 @@ enum SupportBundleCommands {
Create,
/// Delete a support bundle
Delete(SupportBundleDeleteArgs),
/// Download an entire support bundle
Download(SupportBundleDownloadArgs),
/// Download the index of a support bundle
///
/// This is a "list of files", from which individual files can be accessed
GetIndex(SupportBundleIndexArgs),
/// View a file within a support bundle
/// Download a single file within a support bundle
GetFile(SupportBundleFileArgs),
/// Creates a dashboard for viewing the contents of a support bundle
Inspect(SupportBundleInspectArgs),
}

#[derive(Debug, Args)]
struct SupportBundleDeleteArgs {
id: SupportBundleUuid,
}

#[derive(Debug, Args)]
struct SupportBundleDownloadArgs {
id: SupportBundleUuid,

/// Optional output path where the file should be written,
/// instead of stdout.
#[arg(short, long)]
output: Option<Utf8PathBuf>,
}

#[derive(Debug, Args)]
struct SupportBundleIndexArgs {
id: SupportBundleUuid,
Expand All @@ -523,6 +537,23 @@ struct SupportBundleFileArgs {
output: Option<Utf8PathBuf>,
}

#[derive(Debug, Args)]
struct SupportBundleInspectArgs {
/// A specific bundle to inspect.
///
/// If none is supplied, the latest active bundle is used.
/// Mutually exclusive with "path".
#[arg(short, long)]
id: Option<SupportBundleUuid>,

/// A local bundle file to inspect.
///
/// If none is supplied, the latest active bundle is used.
/// Mutually exclusive with "id".
#[arg(short, long)]
path: Option<Utf8PathBuf>,
}

impl NexusArgs {
/// Run a `omdb nexus` subcommand.
pub(crate) async fn run_cmd(
Expand Down Expand Up @@ -731,12 +762,18 @@ impl NexusArgs {
let token = omdb.check_allow_destructive()?;
cmd_nexus_support_bundles_delete(&client, args, token).await
}
NexusCommands::SupportBundles(SupportBundleArgs {
command: SupportBundleCommands::Download(args),
}) => cmd_nexus_support_bundles_download(&client, args).await,
NexusCommands::SupportBundles(SupportBundleArgs {
command: SupportBundleCommands::GetIndex(args),
}) => cmd_nexus_support_bundles_get_index(&client, args).await,
NexusCommands::SupportBundles(SupportBundleArgs {
command: SupportBundleCommands::GetFile(args),
}) => cmd_nexus_support_bundles_get_file(&client, args).await,
NexusCommands::SupportBundles(SupportBundleArgs {
command: SupportBundleCommands::Inspect(args),
}) => cmd_nexus_support_bundles_inspect(&client, args).await,
}
}
}
Expand Down Expand Up @@ -3832,6 +3869,28 @@ async fn write_stream_to_sink(
Ok(())
}

/// Runs `omdb nexus support-bundles download`
async fn cmd_nexus_support_bundles_download(
client: &nexus_client::Client,
args: &SupportBundleDownloadArgs,
) -> Result<(), anyhow::Error> {
let stream = client
.support_bundle_download(args.id.as_untyped_uuid())
.await
.with_context(|| format!("downloading support bundle {}", args.id))?
.into_inner_stream();

let sink: Box<dyn std::io::Write> = match &args.output {
Some(path) => Box::new(std::fs::File::create(path)?),
None => Box::new(std::io::stdout()),
};

write_stream_to_sink(stream, sink)
.await
.with_context(|| format!("streaming support bundle {}", args.id))?;
Ok(())
}

/// Runs `omdb nexus support-bundles get-index`
async fn cmd_nexus_support_bundles_get_index(
client: &nexus_client::Client,
Expand Down Expand Up @@ -3880,3 +3939,16 @@ async fn cmd_nexus_support_bundles_get_file(
})?;
Ok(())
}

/// Runs `omdb nexus support-bundles inspect`
async fn cmd_nexus_support_bundles_inspect(
client: &nexus_client::Client,
args: &SupportBundleInspectArgs,
) -> Result<(), anyhow::Error> {
support_bundle_reader_lib::run_dashboard(
client,
args.id,
args.path.as_ref(),
)
.await
}
23 changes: 23 additions & 0 deletions dev-tools/support-bundle-reader-lib/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[package]
name = "support-bundle-reader-lib"
version = "0.1.0"
edition = "2021"
license = "MPL-2.0"

[lints]
workspace = true

[dependencies]
anyhow.workspace = true
async-trait.workspace = true
bytes.workspace = true
camino.workspace = true
crossterm.workspace = true
futures.workspace = true
nexus-client.workspace = true
omicron-workspace-hack.workspace = true
omicron-uuid-kinds.workspace = true
ratatui.workspace = true
reqwest.workspace = true
tokio.workspace = true
zip.workspace = true
Loading
Loading