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
31 changes: 20 additions & 11 deletions hack/install-ate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ fi
# ATE_DEMOS is an array that registers the prefix name of the demo functions.
ATE_DEMOS=()

# Called by a ${demo}_cmdline handler for an argument it does not own.
ate_demo_flag_unhandled() {
ATE_DEMO_FLAG_HANDLED=false
}

# Include demos.
source "${ROOT}"/hack/install-demo-counter.sh
source "${ROOT}"/hack/install-demo-egress.sh
Expand Down Expand Up @@ -627,7 +632,7 @@ get_actor_status() {
}

# prepare_actor_for_delete suspends (or resumes then suspends) until DeleteActor
# is allowed. Actors must be STATUS_SUSPENDED before deletion.
# accepts the actor: STATUS_SUSPENDED, STATUS_CRASHED, or STATUS_DELETING.
prepare_actor_for_delete() {
local actor_name="$1"
local atespace="$2"
Expand All @@ -641,7 +646,7 @@ prepare_actor_for_delete() {
fi

case "${status}" in
STATUS_SUSPENDED)
STATUS_SUSPENDED | STATUS_CRASHED | STATUS_DELETING)
return 0
;;
STATUS_PAUSED)
Expand All @@ -660,7 +665,7 @@ prepare_actor_for_delete() {
sleep 2
done

echo "timed out waiting for actor ${actor_name} to reach STATUS_SUSPENDED" >&2
echo "timed out waiting for actor ${actor_name} to become deletable" >&2
return 1
}

Expand Down Expand Up @@ -849,17 +854,21 @@ esac
store_backend >/dev/null

while [[ "$#" -gt 0 ]]; do
# Run ${demo}_cmdline if it exists. If it returns 0, then we successfully
# handled this argument and can continue. Otherwise, fallthrough to check
# the other arguments.
# Handlers signal an unclaimed argument via ate_demo_flag_unhandled, not exit
# status: an `if`-condition call would suppress errexit in the whole call tree.
ATE_DEMO_FLAG_HANDLED=false
for demo_name in "${ATE_DEMOS[@]}"; do
if declare -F "${demo_name}_cmdline" >/dev/null 2>&1; then
if "${demo_name}_cmdline" "$1"; then
shift
continue 2
fi
declare -F "${demo_name}_cmdline" >/dev/null 2>&1 || continue
ATE_DEMO_FLAG_HANDLED=true
"${demo_name}_cmdline" "$1"
if [[ "${ATE_DEMO_FLAG_HANDLED}" == "true" ]]; then
break
fi
done
if [[ "${ATE_DEMO_FLAG_HANDLED}" == "true" ]]; then
shift
continue
fi

case $1 in
--ateapi-client-auth=*) ATE_ATEAPI_CLIENT_AUTH="${1#*=}" ;;
Expand Down
3 changes: 1 addition & 2 deletions hack/install-demo-autoscaled-workerpool.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@ demo-autoscaled-workerpool_cmdline() {
--deploy-demo-autoscaled-workerpool) demo-autoscaled-workerpool_deploy ;;
--delete-demo-autoscaled-workerpool) demo-autoscaled-workerpool_delete ;;
*)
return 1
ate_demo_flag_unhandled
;;
esac
return 0
}

demo-autoscaled-workerpool_deploy() {
Expand Down
3 changes: 1 addition & 2 deletions hack/install-demo-claude-code-multiplex.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@ demo-claude-code-multiplex_cmdline() {
--deploy-demo-claude-code-multiplex) demo-claude-code-multiplex_deploy ;;
--delete-demo-claude-code-multiplex) demo-claude-code-multiplex_delete ;;
*)
return 1
ate_demo_flag_unhandled
;;
esac
return 0
}

# Build the workload image, push to ${KO_DOCKER_REPO}, and echo the resolved
Expand Down
3 changes: 1 addition & 2 deletions hack/install-demo-counter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@ demo-counter_cmdline() {
--deploy-demo-counter-with-external-volume) demo-counter_deploy "true" ;;
--delete-demo-counter) demo-counter_delete ;;
*)
return 1
ate_demo_flag_unhandled
;;
esac
return 0
}

demo-counter_deploy() {
Expand Down
3 changes: 1 addition & 2 deletions hack/install-demo-egress.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@ demo-egress_cmdline() {
--deploy-demo-egress) demo-egress_deploy ;;
--delete-demo-egress) demo-egress_delete ;;
*)
return 1
ate_demo_flag_unhandled
;;
esac
return 0
}

demo-egress_deploy() {
Expand Down
3 changes: 1 addition & 2 deletions hack/install-demo-multi-template.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@ demo-multi-template_cmdline() {
--deploy-demo-multi-template) demo-multi-template_deploy ;;
--delete-demo-multi-template) demo-multi-template_delete ;;
*)
return 1
ate_demo_flag_unhandled
;;
esac
return 0
}

demo-multi-template_deploy() {
Expand Down
3 changes: 1 addition & 2 deletions hack/install-demo-parking.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@ demo-parking_cmdline() {
--deploy-demo-parking) demo-parking_deploy ;;
--delete-demo-parking) demo-parking_delete ;;
*)
return 1
ate_demo_flag_unhandled
;;
esac
return 0
}

demo-parking_deploy() {
Expand Down
3 changes: 1 addition & 2 deletions hack/install-demo-sandbox.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@ demo-sandbox_cmdline() {
--deploy-demo-sandbox) demo-sandbox_deploy ;;
--delete-demo-sandbox) demo-sandbox_delete ;;
*)
return 1
ate_demo_flag_unhandled
;;
esac
return 0
}

demo-sandbox_deploy() {
Expand Down