From 08dcf70a394cd1cef74b9d2ddc5ba3179b2ff586 Mon Sep 17 00:00:00 2001 From: Sander Date: Tue, 7 May 2024 20:28:11 +0000 Subject: [PATCH] store-scan: improve error handling when store listing fails --- dist/main/push-paths.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/dist/main/push-paths.sh b/dist/main/push-paths.sh index 16c08a74..1551da2b 100755 --- a/dist/main/push-paths.sh +++ b/dist/main/push-paths.sh @@ -12,10 +12,21 @@ filterPaths() { done | xargs } -pathsToPush=$(comm -13 <(sort /tmp/store-path-pre-build) <("$(dirname "$0")"/list-nix-store.sh)) +pathsToPush="" +preBuildPaths=$(sort /tmp/store-path-pre-build) +if [ $? -eq 0 ]; then + postBuildPaths=$("$(dirname "$0")"/list-nix-store.sh | sort) + if [ $? -eq 0 ]; then + pathsToPush=$(comm -13 <(echo "$preBuildPaths") <(echo "$postBuildPaths")) + else + echo "::error::Failed to list post-build store paths." + fi +else + echo "::error::Failed to find pre-build store paths." +fi if [[ -n $pushFilter ]]; then - pathsToPush=$(filterPaths $pushFilter "$pathsToPush") + pathsToPush=$(filterPaths $pushFilter "$pathsToPush") fi echo "$pathsToPush" | "$cachix" push $cachixArgs "$cache"