From d55faceefb4fe58c32d20d4c4f15e7357166c5ff Mon Sep 17 00:00:00 2001 From: sinavir Date: Fri, 23 Feb 2024 17:35:25 +0100 Subject: [PATCH] fix(check-deployment): add some error handling and fix the "one-node" mode --- scripts/check-deployment.sh | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/scripts/check-deployment.sh b/scripts/check-deployment.sh index 652a274..96371f7 100644 --- a/scripts/check-deployment.sh +++ b/scripts/check-deployment.sh @@ -88,14 +88,23 @@ echo "$RESULTS" | @jq@/bin/jq -c '.[]' | while IFS=$'\n' read -r c; do machine=$(echo "$c" | @jq@/bin/jq -r '.machine') + if [[ -n ${node-} ]] && [[ "$machine" != "$node" ]]; then + echo "Skipping ${machine}" + continue + fi expected_path=$(echo "$c" | @jq@/bin/jq -r '.path') domain=$(echo "$c" | @jq@/bin/jq -r '.domain') drv_path=$(echo "$c" | @jq@/bin/jq -r '.drv') - current_path=$(retrieve_current_system "$domain") + err=0 + current_path=$(retrieve_current_system "$domain") || err=1 + if [[ "1" == "${err}" ]] ; then + echo "❌ failed to contact $domain !" + continue + fi if [ "$expected_path" == "$current_path" ] ; then - echo "$machine -> OK" + echo "✅ $machine -> OK" elif [[ -n ${diff-} ]] ; then nix-copy-closure --from "root@$domain" "$current_path" nix-store -r "$drv_path" @@ -103,9 +112,9 @@ while IFS=$'\n' read -r c; do @nvd@/bin/nvd diff "$expected_path" "$current_path" return_status=1 else - echo "$machine -> error:" - echo " - Expected system: $expected_path" - echo " - Current system: $current_path" + echo "☠️ $machine -> error:" + echo " - Expected system: $expected_path" + echo " - Current system: $current_path" return_status=1 fi done