Skip to content
Open
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
9 changes: 7 additions & 2 deletions install/hiclaw-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1603,8 +1603,9 @@ should_skip_step() {
local _env="${AGENTTEAMS_ENV_FILE:-${HOME}/agentteams-manager.env}"
[ ! -f "${_env}" ] && return 0
;;
# Keep-All upgrade mode: skip all config steps (step_volume/step_workspace handled separately)
step_llm|step_admin|step_network|step_ports|step_domains|step_github|step_skills|step_runtime|step_manager_runtime|step_e2ee|step_docker_proxy|step_idle|step_hostshare)
# Keep-All upgrade mode: skip base config steps. Steps with additional
# mode-specific rules are handled by their dedicated cases below.
step_llm|step_admin|step_network|step_ports|step_domains|step_github|step_skills|step_runtime)
[ "${AGENTTEAMS_UPGRADE}" = "1" ] && [ "${AGENTTEAMS_UPGRADE_KEEP_ALL}" = "1" ] && return 0
;;
step_volume|step_workspace)
Expand All @@ -1615,19 +1616,23 @@ should_skip_step() {
step_e2ee|step_idle)
[ "${AGENTTEAMS_NON_INTERACTIVE}" = "1" ] && return 0
[ "${AGENTTEAMS_QUICKSTART}" = "1" ] && [ "${AGENTTEAMS_UPGRADE}" != "1" ] && return 0
[ "${AGENTTEAMS_UPGRADE}" = "1" ] && [ "${AGENTTEAMS_UPGRADE_KEEP_ALL}" = "1" ] && return 0
;;
step_docker_proxy)
[ "${AGENTTEAMS_NON_INTERACTIVE}" = "1" ] && return 0
[ "${AGENTTEAMS_QUICKSTART}" = "1" ] && [ "${AGENTTEAMS_UPGRADE}" != "1" ] && return 0
# Embedded mode handles docker access natively — skip this step
[ "${AGENTTEAMS_USE_EMBEDDED:-}" = "1" ] && return 0
[ "${AGENTTEAMS_UPGRADE}" = "1" ] && [ "${AGENTTEAMS_UPGRADE_KEEP_ALL}" = "1" ] && return 0
;;
step_manager_runtime)
[ "${AGENTTEAMS_NON_INTERACTIVE}" = "1" ] && return 0
[ "${AGENTTEAMS_UPGRADE}" = "1" ] && [ "${AGENTTEAMS_UPGRADE_KEEP_ALL}" = "1" ] && return 0
;;
step_hostshare)
[ "${AGENTTEAMS_NON_INTERACTIVE}" = "1" ] && return 0
[ "${AGENTTEAMS_QUICKSTART}" = "1" ] && return 0
[ "${AGENTTEAMS_UPGRADE}" = "1" ] && [ "${AGENTTEAMS_UPGRADE_KEEP_ALL}" = "1" ] && return 0
;;
step_podman_autostart)
# Only relevant for Podman with systemd
Expand Down
89 changes: 89 additions & 0 deletions install/tests/test-step-routing.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
#!/usr/bin/env bash

set -euo pipefail

ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
INSTALL_SCRIPT="${INSTALL_SCRIPT:-${ROOT_DIR}/install/hiclaw-install.sh}"

# Load only the routing helper; sourcing the full installer would start Docker.
source <(sed -n '/^should_skip_step() {/,/^}/p' "${INSTALL_SCRIPT}")

PASS=0
FAIL=0

pass() {
printf 'PASS: %s\n' "$1"
PASS=$((PASS + 1))
}

fail() {
printf 'FAIL: %s\n' "$1" >&2
FAIL=$((FAIL + 1))
}

assert_skipped() {
local step="$1"
local context="$2"
if should_skip_step "${step}"; then
pass "${context}: ${step} is skipped"
else
fail "${context}: ${step} should be skipped"
fi
}

assert_runs() {
local step="$1"
local context="$2"
if should_skip_step "${step}"; then
fail "${context}: ${step} should run"
else
pass "${context}: ${step} runs"
fi
}

reset_mode() {
AGENTTEAMS_NON_INTERACTIVE=0
AGENTTEAMS_QUICKSTART=0
AGENTTEAMS_UPGRADE=0
AGENTTEAMS_UPGRADE_KEEP_ALL=0
AGENTTEAMS_USE_EMBEDDED=0
AGENTTEAMS_ENV_FILE="${ROOT_DIR}/install/tests/nonexistent.env"
DOCKER_CMD=docker
}

reset_mode
AGENTTEAMS_QUICKSTART=1
for step in step_e2ee step_idle step_docker_proxy step_hostshare; do
assert_skipped "${step}" "quick start"
done
assert_runs step_manager_runtime "quick start"

reset_mode
AGENTTEAMS_NON_INTERACTIVE=1
for step in step_manager_runtime step_e2ee step_idle step_docker_proxy step_hostshare; do
assert_skipped "${step}" "non-interactive"
done

reset_mode
AGENTTEAMS_USE_EMBEDDED=1
assert_skipped step_docker_proxy "embedded"

reset_mode
AGENTTEAMS_UPGRADE=1
AGENTTEAMS_UPGRADE_KEEP_ALL=1
for step in \
step_llm step_admin step_network step_ports step_domains step_github \
step_skills step_runtime step_manager_runtime step_e2ee step_docker_proxy \
step_idle step_hostshare; do
assert_skipped "${step}" "keep-all upgrade"
done

reset_mode
for step in step_manager_runtime step_e2ee step_idle step_docker_proxy step_hostshare; do
assert_runs "${step}" "manual"
done

printf '\nResults: %d passed, %d failed\n' "${PASS}" "${FAIL}"
if [ "${FAIL}" -ne 0 ]; then
exit 1
fi
Loading