Files
jbod-monitor/build.sh
adam 226f73851c Fix critical lock-expiry window found in Codex second pass
- poller.py: start lock_refresher() IMMEDIATELY after acquiring the lock,
  before the startup jitter and restart-storm deferral. Those sleeps can
  together exceed LOCK_TTL (restart defer is up to POLL_SWEEP_INTERVAL), so
  with the refresher started afterward the lock could expire mid-deferral and
  a second poller could begin sweeping concurrently — the exact hardware-storm
  risk this design prevents.
- hwgate.py: clamp POLL_CONCURRENCY to 1 unless POLL_ALLOW_UNSAFE_CONCURRENCY
  is set (fragile SAS hardware; >1 can drop expanders). Warn either way.
- build.sh: keep backward-compatible — a non-target first arg is treated as
  the commit message (./build.sh "msg" still works), known targets select
  web|poller|all.
2026-06-16 16:26:36 +00:00

46 lines
1.4 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
# Usage: ./build.sh [poller|web|all] [commit message]
# web — build/push ONLY the web image (use this for web iterations so the
# poller image is never rebuilt/repushed)
# poller— build/push ONLY the poller image (touch deliberately)
# all — both (default)
#
# Deploy pins images by SHA (compose.*.yml ship :latest as a convenience only).
REG="docker.adamksmith.xyz"
cd "$(dirname "$0")"
# First arg is the target if it's a known one; otherwise it's treated as the
# commit message (backward-compatible with `./build.sh "message"`).
case "${1:-}" in
poller) TARGETS="poller"; MSG="${2:-Build and push images}" ;;
web) TARGETS="web"; MSG="${2:-Build and push images}" ;;
all|"") TARGETS="poller web"; MSG="${2:-Build and push images}" ;;
*) TARGETS="poller web"; MSG="${1}" ;;
esac
TARGET="${TARGETS// /+}"
# Stage and commit all changes
git add -A
if git diff --cached --quiet; then
echo "No changes to commit, using HEAD"
else
git commit -m "${MSG}"
fi
SHA=$(git rev-parse --short HEAD)
for target in ${TARGETS}; do
img="${REG}/jbod-${target}"
echo "Building ${img}:${SHA}"
docker build --target "${target}" -t "${img}:${SHA}" -t "${img}:latest" .
echo "Pushing ${img}:${SHA}"
docker push "${img}:${SHA}"
docker push "${img}:latest"
done
echo "Done (${TARGET}): ${REG}/jbod-{${TARGETS// /,}}:${SHA}"