taler-monitoring v1.13.12
Multi-phase global SUMMARY, warn-filter dimmed context, SUMMARY chrome as meta; FP stage host-agent via francpaysan-stage-user (stagepaysan); monpages GOA + FP stage.
This commit is contained in:
commit
5a5431bfa9
88 changed files with 21996 additions and 0 deletions
150
host-agent/run-aptdeploy.sh
Executable file
150
host-agent/run-aptdeploy.sh
Executable file
|
|
@ -0,0 +1,150 @@
|
|||
#!/usr/bin/env bash
|
||||
# run-aptdeploy.sh — ensure containers + aptdeploy phase only.
|
||||
#
|
||||
# Keep monitoring current:
|
||||
# 1) Prefer Forgejo origin/main (update-suite reset)
|
||||
# 2) If Forgejo is behind (no aptdeploy yet), re-apply suite-overlay saved
|
||||
# from this agent tree before reset (rsync from laptop fills that tree)
|
||||
# 3) Run ensure + taler-monitoring.sh aptdeploy
|
||||
#
|
||||
# Host: on koopa → local; else ssh APT_DEPLOY_SSH + rsync mon tree first.
|
||||
#
|
||||
set -euo pipefail
|
||||
|
||||
AGENT_DIR=$(cd "$(dirname "$0")" && pwd)
|
||||
BOOT_MON=$(cd "$AGENT_DIR/.." && pwd)
|
||||
MODE="${1:-all}"
|
||||
APT_DEPLOY_SSH="${APT_DEPLOY_SSH:-${DEPLOY_SSH:-}}"
|
||||
OVERLAY_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/taler-monitoring/suite-overlay"
|
||||
|
||||
on_koopa() {
|
||||
local h
|
||||
h=$(hostname -s 2>/dev/null || hostname 2>/dev/null || echo "")
|
||||
case "$h" in koopa|koopa.*) return 0 ;; esac
|
||||
[ "${KOOPA_FORCE_LOCAL:-0}" = "1" ] && return 0
|
||||
return 1
|
||||
}
|
||||
|
||||
mon_has_aptdeploy() {
|
||||
local mon=$1
|
||||
[ -f "$mon/taler-monitoring.sh" ] && grep -qE 'aptdeploy\|apt-deploy' "$mon/taler-monitoring.sh"
|
||||
}
|
||||
|
||||
save_overlay_from() {
|
||||
local src=$1
|
||||
mon_has_aptdeploy "$src" || return 0
|
||||
mkdir -p "$OVERLAY_DIR"
|
||||
rsync -a --delete \
|
||||
--exclude secrets.env \
|
||||
--exclude 'android-test/artifacts' \
|
||||
--exclude 'android-test/apks' \
|
||||
--exclude 'android-test/out*' \
|
||||
--exclude '__pycache__' \
|
||||
"$src/" "$OVERLAY_DIR/"
|
||||
echo "saved suite-overlay from $src → $OVERLAY_DIR"
|
||||
}
|
||||
|
||||
apply_overlay_to() {
|
||||
local dest=$1
|
||||
[ -f "$OVERLAY_DIR/taler-monitoring.sh" ] || return 1
|
||||
mon_has_aptdeploy "$OVERLAY_DIR" || return 1
|
||||
mkdir -p "$dest"
|
||||
rsync -a \
|
||||
--exclude secrets.env \
|
||||
--exclude 'android-test/artifacts' \
|
||||
--exclude 'android-test/apks' \
|
||||
--exclude 'android-test/out*' \
|
||||
--exclude '__pycache__' \
|
||||
"$OVERLAY_DIR/" "$dest/"
|
||||
echo "applied suite-overlay → $dest (Forgejo lag; push origin/main when possible)"
|
||||
return 0
|
||||
}
|
||||
|
||||
pick_mon_tree() {
|
||||
# Preserve working mon before reset wipes tracked files
|
||||
save_overlay_from "$BOOT_MON"
|
||||
|
||||
# shellcheck source=update-suite.sh
|
||||
source "$AGENT_DIR/update-suite.sh"
|
||||
|
||||
local suite_mon="$SUITE_DIR"
|
||||
mkdir -p "$suite_mon"
|
||||
|
||||
if mon_has_aptdeploy "$suite_mon"; then
|
||||
MON_DIR="$suite_mon"
|
||||
echo "using Forgejo suite mon @ ${COMMIT_SHORT:-?} · $MON_DIR"
|
||||
elif apply_overlay_to "$suite_mon" && mon_has_aptdeploy "$suite_mon"; then
|
||||
MON_DIR="$suite_mon"
|
||||
echo "using suite mon + overlay @ ${COMMIT_SHORT:-?} · $MON_DIR"
|
||||
elif mon_has_aptdeploy "$BOOT_MON"; then
|
||||
MON_DIR="$BOOT_MON"
|
||||
echo "WARN: using boot mon $MON_DIR (overlay apply failed)" >&2
|
||||
else
|
||||
echo "ERROR: no mon tree with aptdeploy (Forgejo + overlay empty)" >&2
|
||||
echo " rsync suite from laptop or push to git.hacktivism.ch" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
AGENT_DIR="$MON_DIR/host-agent"
|
||||
export MON_DIR AGENT_DIR SUITE_DIR COMMIT COMMIT_SHORT COMMIT_URL
|
||||
chmod +x "$AGENT_DIR"/*.sh "$MON_DIR"/taler-monitoring.sh "$MON_DIR"/check_*.sh 2>/dev/null || true
|
||||
}
|
||||
|
||||
run_local() {
|
||||
export PATH="${HOME}/.local/bin:/usr/local/bin:/usr/bin:/bin:${PATH:-}"
|
||||
export PYTHONUNBUFFERED=1
|
||||
export PROGRESS_OFF="${PROGRESS_OFF:-0}"
|
||||
|
||||
echo "======== aptdeploy local on $(hostname) mode=$MODE ========"
|
||||
pick_mon_tree
|
||||
|
||||
if [ "$MODE" != "check-only" ]; then
|
||||
bash "$AGENT_DIR/ensure-apt-deploy-test-containers.sh" "$MODE"
|
||||
fi
|
||||
|
||||
cd "$MON_DIR"
|
||||
export CONTINUE_ON_ERROR="${CONTINUE_ON_ERROR:-1}"
|
||||
export INSIDE_PODMAN="${INSIDE_PODMAN:-1}"
|
||||
export LOCAL_STACK="${LOCAL_STACK:-1}"
|
||||
export RUN_TIMEOUT="${RUN_TIMEOUT:-600}"
|
||||
echo "run: $MON_DIR/taler-monitoring.sh -d hacktivism.ch aptdeploy · suite=${COMMIT_SHORT:-?}"
|
||||
./taler-monitoring.sh -d hacktivism.ch aptdeploy
|
||||
}
|
||||
|
||||
run_remote() {
|
||||
echo "======== aptdeploy remote via ssh ${APT_DEPLOY_SSH} mode=$MODE ========"
|
||||
if [ "${APT_DEPLOY_RSYNC:-1}" = "1" ]; then
|
||||
echo "rsync mon suite → ${APT_DEPLOY_SSH}:src/taler-monitoring/"
|
||||
rsync -az \
|
||||
--exclude secrets.env \
|
||||
--exclude 'android-test/artifacts' \
|
||||
--exclude 'android-test/apks' \
|
||||
--exclude 'android-test/out*' \
|
||||
--exclude '__pycache__' \
|
||||
"$BOOT_MON/" \
|
||||
"${APT_DEPLOY_SSH}:src/taler-monitoring/" \
|
||||
|| echo "WARN: rsync failed" >&2
|
||||
fi
|
||||
ssh -o BatchMode=yes -o ConnectTimeout=25 "$APT_DEPLOY_SSH" bash -s -- "$MODE" <<'EOS'
|
||||
set -euo pipefail
|
||||
MODE=${1:-all}
|
||||
export PATH="${HOME}/.local/bin:/usr/local/bin:/usr/bin:/bin:${PATH:-}"
|
||||
export KOOPA_FORCE_LOCAL=1
|
||||
AGENT="$HOME/src/taler-monitoring/host-agent"
|
||||
if [ ! -x "$AGENT/run-aptdeploy.sh" ]; then
|
||||
AGENT="$HOME/src/taler-monitoring/host-agent"
|
||||
fi
|
||||
if [ ! -x "$AGENT/run-aptdeploy.sh" ]; then
|
||||
echo "ERROR: run-aptdeploy.sh missing on remote" >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "remote AGENT=$AGENT"
|
||||
exec bash "$AGENT/run-aptdeploy.sh" "$MODE"
|
||||
EOS
|
||||
}
|
||||
|
||||
if on_koopa; then
|
||||
run_local
|
||||
else
|
||||
run_remote
|
||||
fi
|
||||
Loading…
Add table
Add a link
Reference in a new issue