diff --git a/crates/remote/src/grpc_remote_client.rs b/crates/remote/src/grpc_remote_client.rs index f14a954fc93..cdcad1b862a 100644 --- a/crates/remote/src/grpc_remote_client.rs +++ b/crates/remote/src/grpc_remote_client.rs @@ -310,7 +310,7 @@ impl RemoteClient for GrpcRemoteClient { hash = &digest.hash, code = ?code, "Failed to cache action result: {}", - status.message() + color::muted_light(status.message()), ); Ok(None) @@ -319,7 +319,7 @@ impl RemoteClient for GrpcRemoteClient { hash = &digest.hash, code = ?code, "Remote service is out of storage space: {}", - status.message() + color::muted_light(status.message()), ); Ok(None) @@ -398,11 +398,11 @@ impl RemoteClient for GrpcRemoteClient { details = ?status.details, code = ?code, "Failed to download blob: {}", - if status.message.is_empty() { + color::muted_light(if status.message.is_empty() { code.to_string() } else { status.message - } + }), ); } } @@ -479,7 +479,7 @@ impl RemoteClient for GrpcRemoteClient { hash = &digest.hash, code = ?code, "Remote service exhausted resource: {}", - status.message() + color::muted_light(status.message()), ); Ok(vec![]) @@ -503,11 +503,11 @@ impl RemoteClient for GrpcRemoteClient { details = ?status.details, code = ?code, "Failed to upload blob: {}", - if status.message.is_empty() { + color::muted_light(if status.message.is_empty() { code.to_string() } else { status.message - } + }), ); } } @@ -575,7 +575,8 @@ impl RemoteClient for GrpcRemoteClient { warn!( hash = &digest.hash, blob_hash = &blob.digest.hash, - "Failed to stream upload blob: {error}", + "Failed to stream upload blob: {}", + color::muted_light(error.to_string()), ); return Ok(None); diff --git a/crates/remote/src/http_remote_client.rs b/crates/remote/src/http_remote_client.rs index 47001137334..26bcb8e73b7 100644 --- a/crates/remote/src/http_remote_client.rs +++ b/crates/remote/src/http_remote_client.rs @@ -247,7 +247,7 @@ impl RemoteClient for HttpRemoteClient { hash = &digest.hash, code = status.as_u16(), "Failed to cache action result: {}", - status + color::muted_light(status.to_string()), ); Ok(None) @@ -305,14 +305,16 @@ impl RemoteClient for HttpRemoteClient { warn!( hash = &action_hash, blob_hash = &blob_digest.hash, - "Failed to download blob: {status}", + "Failed to download blob: {}", + color::muted_light(status.to_string()), ); } Err(error) => { warn!( hash = &action_hash, blob_hash = &blob_digest.hash, - "Failed to download blob: {error}", + "Failed to download blob: {}", + color::muted_light(error.to_string()), ); if debug_enabled { @@ -383,14 +385,16 @@ impl RemoteClient for HttpRemoteClient { warn!( hash = &action_hash, blob_hash = &blob.digest.hash, - "Failed to upload blob: {status}", + "Failed to upload blob: {}", + color::muted_light(status.to_string()), ); } Err(error) => { warn!( hash = &action_hash, blob_hash = &blob.digest.hash, - "Failed to upload blob: {error}", + "Failed to upload blob: {}", + color::muted_light(error.to_string()), ); if debug_enabled { diff --git a/crates/remote/src/lib.rs b/crates/remote/src/lib.rs index e4309352936..f4ffbf9fcd2 100644 --- a/crates/remote/src/lib.rs +++ b/crates/remote/src/lib.rs @@ -18,7 +18,4 @@ pub use remote_service::*; // TODO: // - Other digest functions besides sha256 -// - Proper error handling // - Directory blob types -// - Write/read bytestream for large blobs -// - TLS/mTLS issues diff --git a/crates/remote/src/remote_service.rs b/crates/remote/src/remote_service.rs index 4e58e90a335..99d7dd978e2 100644 --- a/crates/remote/src/remote_service.rs +++ b/crates/remote/src/remote_service.rs @@ -392,28 +392,35 @@ async fn batch_upload_blobs( let client = Arc::clone(&client); let digest = digest.to_owned(); + // Streaming if group.stream { set.spawn(async move { - if let Err(error) = client + match client .stream_update_blob(&digest, group.items.remove(0)) .await { - warn!( - hash = &digest.hash, - group = group_index + 1, - "Failed to upload blob: {}", - color::muted_light(error.to_string()), - ); - - return false; - } + Ok(result) => { + if result.is_some() { + return true; + } + } + Err(error) => { + warn!( + hash = &digest.hash, + group = group_index + 1, + "Failed to stream upload blob: {}", + color::muted_light(error.to_string()), + ); + } + }; - true + false }); continue; } + // Not streaming if group_total > 1 { trace!( hash = &digest.hash, @@ -427,18 +434,23 @@ async fn batch_upload_blobs( } set.spawn(async move { - if let Err(error) = client.batch_update_blobs(&digest, group.items).await { - warn!( - hash = &digest.hash, - group = group_index + 1, - "Failed to upload blobs: {}", - color::muted_light(error.to_string()), - ); - - return false; - } + match client.batch_update_blobs(&digest, group.items).await { + Ok(result) => { + if result.into_iter().all(|res| res.is_some()) { + return true; + } + } + Err(error) => { + warn!( + hash = &digest.hash, + group = group_index + 1, + "Failed to upload blobs: {}", + color::muted_light(error.to_string()), + ); + } + }; - true + false }); }