126 lines
5.1 KiB
Bash
126 lines
5.1 KiB
Bash
#!/usr/bin/env bash
|
|
# Run all tasks that do NOT require LAN, Proxmox SSH, PRIVATE_KEY, or NPM_PASSWORD.
|
|
# Use from dev machine / WSL / CI. For tasks that need LAN/creds, see run-operator-tasks-from-lan.sh.
|
|
# Usage: ./scripts/run-completable-tasks-from-anywhere.sh [--dry-run]
|
|
# --dry-run Print the five steps only; do not run them (exit 0).
|
|
#
|
|
# Exit codes (Unix convention): 0 = success (all steps passed), non-zero = failure.
|
|
# Do not "fix" exit 0 — it means the script completed successfully.
|
|
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
cd "$PROJECT_ROOT"
|
|
|
|
# shellcheck source=./scripts/lib/run-summary.sh
|
|
source "$SCRIPT_DIR/lib/run-summary.sh"
|
|
|
|
RUN_STARTED_AT="$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
|
|
SECONDS=0
|
|
|
|
DRY_RUN=false
|
|
JSON_OUT=""
|
|
while [[ $# -gt 0 ]]; do
|
|
case "$1" in
|
|
--dry-run)
|
|
DRY_RUN=true
|
|
shift
|
|
;;
|
|
--json-out)
|
|
[[ $# -ge 2 ]] || { echo "Missing value for --json-out" >&2; exit 1; }
|
|
JSON_OUT="$2"
|
|
shift 2
|
|
;;
|
|
-h|--help)
|
|
sed -n '1,8p' "$0"
|
|
echo " --json-out PATH Write a machine-readable run summary JSON."
|
|
exit 0
|
|
;;
|
|
*)
|
|
echo "Unknown argument: $1" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
done
|
|
|
|
RUN_STATUS="failed"
|
|
RUN_MODE="run"
|
|
run_summary_init "run-completable-tasks-from-anywhere.sh" "$RUN_STARTED_AT" "$JSON_OUT"
|
|
trap 'run_summary_write "$RUN_STATUS" "$SECONDS" "$RUN_MODE"; run_summary_cleanup' EXIT
|
|
|
|
format_duration() {
|
|
local total="$1"
|
|
printf '%02dm:%02ds' "$((total / 60))" "$((total % 60))"
|
|
}
|
|
|
|
if $DRY_RUN; then
|
|
RUN_MODE="dry-run"
|
|
run_summary_record_step "1" "Config validation" "planned" "0"
|
|
run_summary_record_step "2" "On-chain contract check (Chain 138)" "planned" "0"
|
|
run_summary_record_step "3" "Run all validation (--skip-genesis)" "planned" "0"
|
|
run_summary_record_step "4" "Non-EVM public health + lane status" "planned" "0"
|
|
run_summary_record_step "5" "Canonical .env reconciliation output" "planned" "0"
|
|
RUN_STATUS="success"
|
|
echo "=== Completable from anywhere (--dry-run: commands only) ==="
|
|
echo ""
|
|
echo "1. Config validation: bash scripts/validation/validate-config-files.sh [--dry-run]"
|
|
echo "2. On-chain check (138): SKIP_EXIT=1 bash scripts/verify/check-contracts-on-chain-138.sh || true"
|
|
echo "3. All validation: bash scripts/verify/run-all-validation.sh --skip-genesis (includes cW* mesh matrix when pair-discovery JSON exists)"
|
|
echo "4. Non-EVM status: bash scripts/verify/check-non-evm-network-health.sh --json-out reports/status/non-evm-network-health-latest.json && python3 scripts/verify/build-non-evm-lane-status.py"
|
|
echo "5. Reconcile .env: bash scripts/verify/reconcile-env-canonical.sh --print"
|
|
echo ""
|
|
echo "Run without --dry-run to execute. Exit 0 = success."
|
|
exit 0
|
|
fi
|
|
|
|
echo "=== Completable from anywhere (no LAN/creds) ==="
|
|
echo "Started (UTC): $RUN_STARTED_AT"
|
|
echo ""
|
|
|
|
# 1. Config validation
|
|
echo "[Step 1/5] Config validation..."
|
|
STEP_STARTED=$SECONDS
|
|
bash scripts/validation/validate-config-files.sh
|
|
run_summary_record_step "1" "Config validation" "success" "$((SECONDS - STEP_STARTED))"
|
|
echo " Completed in $(format_duration "$((SECONDS - STEP_STARTED))")"
|
|
echo ""
|
|
|
|
# 2. On-chain contract check (Chain 138) — may warn if RPC unreachable
|
|
echo "[Step 2/5] On-chain contract check (Chain 138)..."
|
|
STEP_STARTED=$SECONDS
|
|
SKIP_EXIT=1 bash scripts/verify/check-contracts-on-chain-138.sh || true
|
|
run_summary_record_step "2" "On-chain contract check (Chain 138)" "success" "$((SECONDS - STEP_STARTED))"
|
|
echo " Completed in $(format_duration "$((SECONDS - STEP_STARTED))")"
|
|
echo ""
|
|
|
|
# 3. Full validation (skip genesis to avoid RPC; includes cW* mesh matrix when pair-discovery JSON exists)
|
|
echo "[Step 3/5] Run all validation (--skip-genesis)..."
|
|
STEP_STARTED=$SECONDS
|
|
bash scripts/verify/run-all-validation.sh --skip-genesis
|
|
run_summary_record_step "3" "Run all validation (--skip-genesis)" "success" "$((SECONDS - STEP_STARTED))"
|
|
echo " Completed in $(format_duration "$((SECONDS - STEP_STARTED))")"
|
|
echo ""
|
|
|
|
# 4. Non-EVM public health + repo-backed lane status
|
|
echo "[Step 4/5] Non-EVM public health + lane status..."
|
|
STEP_STARTED=$SECONDS
|
|
bash scripts/verify/check-non-evm-network-health.sh --json-out reports/status/non-evm-network-health-latest.json
|
|
python3 scripts/verify/build-non-evm-lane-status.py
|
|
run_summary_record_step "4" "Non-EVM public health + lane status" "success" "$((SECONDS - STEP_STARTED))"
|
|
echo " Completed in $(format_duration "$((SECONDS - STEP_STARTED))")"
|
|
echo ""
|
|
|
|
# 5. Emit canonical .env lines for reconciliation
|
|
echo "[Step 5/5] Canonical .env (reconcile smom-dbis-138/.env)..."
|
|
STEP_STARTED=$SECONDS
|
|
bash scripts/verify/reconcile-env-canonical.sh --print
|
|
run_summary_record_step "5" "Canonical .env reconciliation output" "success" "$((SECONDS - STEP_STARTED))"
|
|
echo " Completed in $(format_duration "$((SECONDS - STEP_STARTED))")"
|
|
echo ""
|
|
|
|
echo "=== Done. Tasks requiring LAN or credentials: run scripts/run-all-operator-tasks-from-lan.sh from a host on LAN with NPM_PASSWORD/PRIVATE_KEY set. ==="
|
|
echo "Total elapsed: $(format_duration "$SECONDS")"
|
|
RUN_STATUS="success"
|
|
exit 0
|