Files
samsjaandGitHub 632ef2b318
Docker Push / Push CUDA image to Docker (push) Canceled after 0s
chore: remove private configs submodule (#2741)
Remove the configs/private submodule (research-configs) and all
references to it throughout the codebase:

- Remove submodule from .gitmodules and git tracking
- Simplify install.sh: use plain git submodule update --init --recursive
  now that no private submodule can fail for users without access
- Update skills/install/SKILL.md to reflect simplified submodule init
- Remove configs/private/ entry from skills/configs/SKILL.md key files
- Simplify test_configs.py: no longer need to filter out private/ path
2026-06-09 19:31:08 -07:00

160 lines
4.9 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
# Colors for output
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m' # No Color
log_info() { echo -e "${GREEN}[INFO]${NC} $*"; }
log_warn() { echo -e "${YELLOW}[WARN]${NC} $*"; }
log_error() { echo -e "${RED}[ERROR]${NC} $*" >&2; }
REPO_ID="prime-rl"
# Flag defaults (can be overridden via env)
SKIP_CLONE=${SKIP_CLONE:-0}
assert_supported_platform() {
local os arch
os="$(uname -s)"
arch="$(uname -m)"
if [ "$os" != "Linux" ]; then
log_error "Unsupported platform: ${os}/${arch}."
log_error "prime-rl currently supports Linux on x86_64 or aarch64 only."
exit 1
fi
case "$arch" in
x86_64 | aarch64) ;;
*)
log_error "Unsupported architecture: ${arch}."
log_error "prime-rl currently supports Linux on x86_64 or aarch64 only."
exit 1
;;
esac
if ! command -v apt &>/dev/null; then
log_error "Unsupported Linux distribution: apt is required by this installer."
log_error "Use a Debian/Ubuntu-based Linux machine on x86_64 or aarch64, or install manually."
exit 1
fi
}
has_ssh_access() {
# Probe GitHub SSH auth directly. `ssh -T git@github.com` returns
# "successfully authenticated" only when the local key is registered
# with a GitHub user, which is the precondition for cloning private
# submodules over SSH. The previous `git ls-remote` probe could
# spuriously succeed (cached creds, public-repo edge cases) and
# leave submodule clones to fail later.
#
# Note: ssh -T git@github.com always exits 1 (GitHub denies shell
# access after authenticating), so we capture stdout/stderr to a var
# first and grep the var. Piping directly would trigger pipefail.
set +e
out=$(timeout 5s ssh -o BatchMode=yes -T git@github.com 2>&1)
echo "$out" | grep -q "successfully authenticated"
rc=$?
set -e
return $rc
}
ensure_known_hosts() {
# Make sure ~/.ssh exists with the right perms, then add GitHub host key.
mkdir -p "${HOME}/.ssh"
chmod 700 "${HOME}/.ssh"
# Use -H to hash hostnames; merge uniquely to avoid dupes.
if command -v ssh-keyscan >/dev/null 2>&1; then
ssh-keyscan -H github.com 2>/dev/null | sort -u |
tee -a "${HOME}/.ssh/known_hosts" >/dev/null
chmod 600 "${HOME}/.ssh/known_hosts"
fi
}
init_submodules() {
if [ ! -f .gitmodules ]; then
return 0
fi
git submodule update --init --recursive
}
main() {
assert_supported_platform
# Ensure sudo exists
if ! command -v sudo &>/dev/null; then
apt update
apt install -y sudo
fi
log_info "Installing base packages..."
sudo apt update
sudo apt install -y build-essential openssh-client curl git tmux htop nvtop
log_info "Configuring SSH known_hosts for GitHub..."
ensure_known_hosts
if [ "$SKIP_CLONE" -eq 1 ]; then
log_info "Skipping clone; assuming we are already inside the repo."
else
log_info "Determining best way to clone (SSH vs HTTPS)..."
if has_ssh_access; then
log_info "SSH access to GitHub works. Cloning via SSH."
git clone git@github.com:PrimeIntellect-ai/${REPO_ID}.git
else
log_warn "SSH auth to GitHub not available. Cloning via HTTPS."
git clone https://github.com/PrimeIntellect-ai/${REPO_ID}.git
fi
log_info "Entering project directory..."
cd ${REPO_ID}
fi
if ! has_ssh_access; then
# Propagate the rewrite via env vars so it reaches `git submodule--helper clone`,
# which spawns fresh `git clone` processes that do not read the parent repo's
# local `.git/config`. Local `git config url..insteadOf` is invisible to them.
log_info "Routing git@github.com: SSH URLs to HTTPS for this run."
export GIT_CONFIG_COUNT=1
export GIT_CONFIG_KEY_0="url.https://github.com/.insteadOf"
export GIT_CONFIG_VALUE_0="git@github.com:"
fi
log_info "Initializing submodules..."
init_submodules
log_info "Installing uv..."
curl -LsSf https://astral.sh/uv/install.sh | sh
log_info "Sourcing uv environment..."
if ! command -v uv &>/dev/null; then
source $HOME/.local/bin/env
fi
log_info "Installing prime..."
uv tool install prime
log_info "Syncing virtual environment..."
uv sync --all-extras
log_info "Installing pre-commit hooks..."
uv run pre-commit install
# aarch64 has no prebuilt flash-attn wheel; build it from source for the local GPU.
# Without this, `import flash_attn` fails with `ModuleNotFoundError: flash_attn_2_cuda`.
# Run last so no subsequent uv operation (which implicitly syncs against the lockfile)
# rebuilds flash-attn from PyPI with FLASH_ATTENTION_SKIP_CUDA_BUILD=TRUE and undoes this.
if [ "$(uname -m)" = "aarch64" ]; then
log_info "aarch64 detected: building flash-attn from source (this takes 20-30 minutes)..."
log_warn "Future 'uv sync --all-extras' or 'uv run' will remove this build. Use 'uv sync --inexact' or 'uv run --no-sync' to keep it."
bash scripts/docker-arm64-post-install.sh
fi
log_info "Installation completed!"
}
main