Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion scripts/swm-macos-runner/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export TART_HOME
# Per-call limits in seconds for the tart commands.
: "${SWM_CLONE_LIMIT_S:=600}"
: "${SWM_RUN_LIMIT_S:=30}"
# The supervisor bounds the ip call at SWM_IP_LIMIT_S + 10 (190 s), above 180 on purpose:
# tart ip --wait gets the full limit to give up first.
: "${SWM_IP_LIMIT_S:=180}"
: "${SWM_EXEC_LIMIT_S:=60}"
: "${SWM_STOP_LIMIT_S:=60}"
Expand Down Expand Up @@ -58,7 +60,7 @@ _swm_sha256() {
if command -v "${SHA256SUM_BIN}" >/dev/null 2>&1; then "${SHA256SUM_BIN}" "$@"; else "${SHASUM_BIN}" -a 256 "$@"; fi
}

# _swm_image_hash DIR: 12 hex over file digests plus the base digest (as NOS _nos_image_hash).
# _swm_image_hash DIR: 12 hex over file digests plus the base digest (copy of _nos_image_hash, nos-runner/config.sh; change both).
_swm_image_hash() {
local files f d list=""
files="$(cd "$1" && find . -type f)" || return 1
Expand Down
8 changes: 7 additions & 1 deletion scripts/swm-macos-runner/supervisor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,13 @@ slot_load() {
while IFS='=' read -r k v; do
case "${k}" in
name) SL_NAME="${v}" ;;
id) SL_ID="${v}" ;;
id)
if [[ -z "${v}" || "${v}" =~ ^[0-9]+$ ]]; then
SL_ID="${v}"
else
log "ignoring non-numeric runner id '${v}' in ${SLOT_FILE}"
fi
;;
fails) [[ "${v}" =~ ^[0-9]+$ ]] && SL_FAILS="${v}" ;;
alert) SL_ALERT="${v}" ;;
job) SL_JOB="${v:-0}" ;;
Expand Down
8 changes: 8 additions & 0 deletions scripts/swm-macos-runner/tests/test-supervisor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,14 @@ check_is "orphan: no clone while id= is still registered" 0 "$(clones)"
check_is "orphan: id= kept for retry" 999 "$(slot id)"
check_is "orphan: fails=1" 1 "$(slot fails)"

echo "-- a non-numeric id= in the state file is never put in a URL"
reset
mkdir -p "${S}/state"
printf 'name=\nid=../x\nfails=0\nalert=\njob=0\n' >"${S}/state/slot"
sup once
check_not "bad id: no request URL contains ../x" grep -qF -- '../x' "${S}/requests.log"
check "bad id: log names the bad id" grep -qF -- '../x' "${S}/sup.err"

echo "-- pf ok stale -> no mint, one pf alert"
reset
touch -t 200001010000 "${S}/pf.ok"
Expand Down
Loading