From f870f321103bd549c75c02ac9b5d9632a0d7f761 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Wei=C3=9Fe?= Date: Thu, 27 Jun 2024 11:04:31 +0200 Subject: [PATCH] just: add recover target --- justfile | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/justfile b/justfile index a6354882f5..9bb682b0c2 100644 --- a/justfile +++ b/justfile @@ -171,6 +171,27 @@ verify cli=default_cli: echo "Verified in $duration seconds." echo "verify $duration" >> ./{{ workspace_dir }}/just.perf +# Recover the Coordinator. +recover cli=default_cli: + #!/usr/bin/env bash + set -euo pipefail + ns=$(cat ./{{ workspace_dir }}/just.namespace) + nix run .#scripts.kubectl-wait-ready -- $ns coordinator + nix run .#scripts.kubectl-wait-ready -- $ns port-forwarder-coordinator + kubectl -n $ns port-forward pod/port-forwarder-coordinator 1313 & + PID=$! + trap "kill $PID" EXIT + nix run .#scripts.wait-for-port-listen -- 1313 + policy=$(< ./{{ workspace_dir }}/coordinator-policy.sha256) + t=$(date +%s) + nix run .#{{ cli }} -- recover \ + --workspace-dir ./{{ workspace_dir }} \ + --coordinator-policy-hash "$policy" \ + -c localhost:1313 + duration=$(( $(date +%s) - $t )) + echo "Recovered in $duration seconds." + echo "recover $duration" >> ./{{ workspace_dir }}/just.perf + # Wait for workloads to become ready. wait-for-workload target=default_deploy_target: #!/usr/bin/env bash