Skip to content

Commit

Permalink
Log http no cert scenario with soft_error
Browse files Browse the repository at this point in the history
Summary: Http clients currently have a fallback where even if there are no valid certs, it attempts to proceed with the default client. Logging with soft_error to see how often builds actually pass

Reviewed By: iguridi

Differential Revision: D59342052

fbshipit-source-id: 46cf2496bef34551534a8239e4c6da26d877ee93
  • Loading branch information
Will-MingLun-Li authored and facebook-github-bot committed Jul 11, 2024
1 parent 7bf3c8c commit b97b4da
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/buck2_http/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ rust_library(
"fbsource//third-party/rust:tracing",
"//buck2/allocative/allocative:allocative",
"//buck2/app/buck2_certs:buck2_certs",
"//buck2/app/buck2_core:buck2_core",
"//buck2/app/buck2_error:buck2_error",
"//buck2/gazebo/dupe:dupe",
# @oss-disable: "//common/rust/cpe:cpe",
Expand Down
1 change: 1 addition & 0 deletions app/buck2_http/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ allocative = { workspace = true }
dupe = { workspace = true }

buck2_certs = { workspace = true }
buck2_core = { workspace = true }
buck2_error = { workspace = true }

[target.'cfg(unix)'.dependencies]
Expand Down
7 changes: 6 additions & 1 deletion app/buck2_http/src/client/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use buck2_certs::certs::find_internal_cert;
use buck2_certs::certs::supports_vpnless;
use buck2_certs::certs::tls_config_with_single_cert;
use buck2_certs::certs::tls_config_with_system_roots;
use buck2_core::soft_error;
use hyper::client::HttpConnector;
use hyper::service::Service;
use hyper::Body;
Expand Down Expand Up @@ -88,7 +89,11 @@ impl HttpClientBuilder {
tracing::debug!("Using internal https client");
builder.with_client_auth_cert(cert_path).await?;
} else {
tracing::debug!("Using default https client");
soft_error!(
"http_client_no_certs",
anyhow::anyhow!("Using default http client with no certs"),
quiet: true
)?;
}

Ok(builder)
Expand Down

0 comments on commit b97b4da

Please sign in to comment.