From 9813c860555467376faed2550ba0db0b85539b3a Mon Sep 17 00:00:00 2001 From: Zyy Date: Thu, 15 Oct 2026 11:14:58 +0800 Subject: [PATCH] fix(ci): stream Cargo cache snapshots through tar Export BuildKit cache snapshots as a tar stream and extract directly into the temporary directory to avoid local exporter stalls. Preserve snapshot validation and pipeline error propagation before replacing the saved cache. Co-authored-by: Codex --- .github/actions/cargo-cache/cargo-cache.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/actions/cargo-cache/cargo-cache.sh b/.github/actions/cargo-cache/cargo-cache.sh index ec4d178a4..781112dc9 100644 --- a/.github/actions/cargo-cache/cargo-cache.sh +++ b/.github/actions/cargo-cache/cargo-cache.sh @@ -42,8 +42,11 @@ else mkdir -p "$(dirname "$directory")" temporary="$(mktemp -d "${directory}.XXXXXX")" trap 'rm -rf "$temporary"' EXIT - mkdir "$temporary/context" - "${command[@]}" --output "type=local,dest=$temporary/snapshot" "$temporary/context" + mkdir "$temporary"/{context,snapshot} + # tar 流避开 local exporter 的逐文件同步阻塞,直接解包以免额外落盘整份归档。 + # https://github.com/moby/buildkit/issues/2950 + "${command[@]}" --output type=tar,dest=- "$temporary/context" \ + | tar -xf - -C "$temporary/snapshot" if usable "$temporary/snapshot"; then rm -rf "$directory" mv "$temporary/snapshot" "$directory"