Files
awoooi/scripts/ci/bootstrap-host-runner-tools.sh
2026-07-18 19:39:43 +08:00

44 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
required_commands=(node npm git curl bash timeout python3 ssh docker)
missing_commands=()
for command_name in "${required_commands[@]}"; do
if ! command -v "${command_name}" >/dev/null 2>&1; then
missing_commands+=("${command_name}")
fi
done
if command -v docker >/dev/null 2>&1 && \
! docker buildx version >/dev/null 2>&1; then
missing_commands+=(docker-buildx)
fi
if [ "${#missing_commands[@]}" -eq 0 ]; then
echo "host_runner_tools_ready=1 bootstrap_install_performed=0"
exit 0
fi
printf 'host_runner_tools_missing=%s\n' "$(IFS=,; echo "${missing_commands[*]}")"
if ! command -v apk >/dev/null 2>&1; then
echo "BLOCKER host_runner_tools_missing_and_apk_unavailable"
exit 1
fi
apk add --no-cache \
nodejs npm git curl bash coreutils python3 openssh-client docker-cli docker-cli-buildx
for command_name in "${required_commands[@]}"; do
command -v "${command_name}" >/dev/null 2>&1 || {
echo "BLOCKER host_runner_tool_install_failed command=${command_name}"
exit 1
}
done
docker buildx version >/dev/null 2>&1 || {
echo "BLOCKER host_runner_tool_install_failed command=docker-buildx"
exit 1
}
echo "host_runner_tools_ready=1 bootstrap_install_performed=1"