feat: smart capacity defaults and per-runner data paths in runner wizard

- Capacity defaults: Unraid=2, Fedora=2, macOS=1 (based on host type)
- Data path appends runner name to base path to prevent collisions
- RUNNER_DEFAULT_DATA_PATH → RUNNER_DATA_BASE_PATH
- LOCAL_RUNNER_DATA_PATH → LOCAL_RUNNER_DATA_BASE_PATH

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
S
2026-03-01 10:11:16 -05:00
parent 567f507d05
commit c68c387091

View File

@@ -16,7 +16,7 @@ RUNNERS_CONF="${PROJECT_ROOT}/runners.conf"
# shellcheck disable=SC1091 # shellcheck disable=SC1091
source "${PROJECT_ROOT}/lib/common.sh" source "${PROJECT_ROOT}/lib/common.sh"
# Load .env for defaults (RUNNER_DEFAULT_IMAGE, RUNNER_DEFAULT_CAPACITY, etc.) # Load .env for defaults (RUNNER_DEFAULT_IMAGE, RUNNER_DATA_BASE_PATH, etc.)
load_env load_env
# Colors — only emit ANSI escapes when stdout is a terminal (not piped/redirected) # Colors — only emit ANSI escapes when stdout is a terminal (not piped/redirected)
@@ -404,9 +404,9 @@ for ((i = 0; i < runner_count; i++)); do
fi fi
if [[ -z "$path_default" ]]; then if [[ -z "$path_default" ]]; then
if [[ "$r_type" == "native" ]]; then if [[ "$r_type" == "native" ]]; then
path_default="${LOCAL_RUNNER_DATA_PATH:-~/gitea-runner}" path_default="${LOCAL_RUNNER_DATA_BASE_PATH:-~/gitea-runner}/${r_name}"
else else
path_default="${RUNNER_DEFAULT_DATA_PATH:-/mnt/nvme/gitea-runner}" path_default="${RUNNER_DATA_BASE_PATH:-/mnt/nvme/gitea-runner}/${r_name}"
fi fi
fi fi
prompt_field "data_path" "absolute path for runner data" "runner_path" "$path_default" prompt_field "data_path" "absolute path for runner data" "runner_path" "$path_default"
@@ -460,7 +460,12 @@ for ((i = 0; i < runner_count; i++)); do
cap_default=$(ini_default_get "$ex_name" "capacity" "") cap_default=$(ini_default_get "$ex_name" "capacity" "")
fi fi
if [[ -z "$cap_default" ]]; then if [[ -z "$cap_default" ]]; then
cap_default="${RUNNER_DEFAULT_CAPACITY:-1}" # Smart defaults per host type
case "$r_host" in
UNRAID) cap_default=2 ;;
FEDORA) cap_default=2 ;;
*) cap_default=1 ;; # macOS / native
esac
fi fi
prompt_field "capacity" "max concurrent jobs (>= 1)" "capacity" "$cap_default" prompt_field "capacity" "max concurrent jobs (>= 1)" "capacity" "$cap_default"
save_runner_field "$r_name" "capacity" "$PROMPT_RESULT" save_runner_field "$r_name" "capacity" "$PROMPT_RESULT"