-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathsetup-arch.sh
More file actions
executable file
·87 lines (76 loc) · 3.67 KB
/
setup-arch.sh
File metadata and controls
executable file
·87 lines (76 loc) · 3.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/bash
# CI setup script for Arch Linux droplets.
# Runs as root on a fresh droplet. Tests the interactive installer,
# then runs the test suite.
#
# Expects: /tmp/baudbot-src.tar.gz already uploaded via scp.
set -euo pipefail
echo "=== [Arch] Installing base CI deps ==="
pacman -Sy --noconfirm --needed git jq sudo 2>&1 | tail -3
echo "=== Preparing source ==="
useradd -m -s /bin/bash baudbot_admin
mkdir -p /home/baudbot_admin/baudbot
cd /home/baudbot_admin/baudbot
tar xzf /tmp/baudbot-src.tar.gz
chown -R baudbot_admin:baudbot_admin /home/baudbot_admin/
sudo -u baudbot_admin bash -c 'cd ~/baudbot && git init -q && git config user.email "ci@test" && git config user.name "CI" && git add -A && git commit -q -m "init"'
echo "=== Running bootstrap + baudbot install ==="
# Bootstrap installs /usr/local/bin/baudbot, then baudbot install runs install.sh.
# Use file:// URLs so CI tests the uploaded source bundle (not GitHub main).
BAUDBOT_CLI_URL="file:///home/baudbot_admin/baudbot/bin/baudbot" \
BAUDBOT_BOOTSTRAP_TARGET="/usr/local/bin/baudbot" \
bash /home/baudbot_admin/baudbot/bootstrap.sh
# Simulate interactive input: admin user, provider + Slack mode selections,
# required secrets, skip optional integrations, decline launch.
# Prompts: admin user, LLM choice(1=Anthropic), Anthropic key,
# Slack mode(2=advanced), Slack bot, Slack app, Slack users,
# Browser?(n), Sentry?(n), launch(n)
printf 'baudbot_admin\n1\nsk-ant-testkey\n2\nxoxb-test\nxapp-test\nU01TEST\nn\nn\nn\n' \
| BAUDBOT_INSTALL_SCRIPT_URL="file:///home/baudbot_admin/baudbot/install.sh" baudbot install
echo "=== Verifying install ==="
# .env exists with correct permissions
test -f /home/baudbot_agent/.config/.env
test "$(stat -c '%a' /home/baudbot_agent/.config/.env)" = "600"
test "$(stat -c '%U' /home/baudbot_agent/.config/.env)" = "baudbot_agent"
# Runtime deployed
test -f /home/baudbot_agent/runtime/start.sh
test -d /home/baudbot_agent/.pi/agent/extensions
# Admin config written
test -f /home/baudbot_admin/.baudbot/.env
grep -q "ANTHROPIC_API_KEY=sk-ant-testkey" /home/baudbot_admin/.baudbot/.env
# Deployed to agent
grep -q "ANTHROPIC_API_KEY=sk-ant-testkey" /home/baudbot_agent/.config/.env
grep -q "SLACK_BOT_TOKEN=xoxb-test" /home/baudbot_agent/.config/.env
grep -q "BAUDBOT_SOURCE_DIR=" /home/baudbot_agent/.config/.env
# CLI installed and points at /opt release snapshot
test -L /usr/local/bin/baudbot
test -d /opt/baudbot/releases
test -L /opt/baudbot/current
CLI_TARGET=$(readlink -f /usr/local/bin/baudbot)
echo "$CLI_TARGET" | grep -qE '^/opt/baudbot/releases/.+/bin/baudbot$'
# /opt releases must be git-free
! find /opt/baudbot/releases -type d -name .git -print -quit | grep -q .
baudbot --version
HELP_OUT=$(baudbot --help)
echo "$HELP_OUT" | grep -q "baudbot"
# varlock installed for agent user
test -x /home/baudbot_agent/.varlock/bin/varlock
# Agent can load env (smoke test — varlock validates schema + .env)
sudo -u baudbot_agent bash -c 'export PATH="$HOME/.varlock/bin:$HOME/opt/node/bin:$PATH" && cd ~ && varlock load --path ~/.config/'
echo " ✓ bootstrap + install verification passed"
echo "=== Running CLI smoke checks ==="
bash /home/baudbot_admin/baudbot/bin/ci/smoke-cli.sh
echo "=== Running runtime smoke checks ==="
bash /home/baudbot_admin/baudbot/bin/ci/smoke-agent-runtime.sh
echo "=== Running inference smoke check ==="
bash /home/baudbot_admin/baudbot/bin/ci/smoke-agent-inference.sh
echo "=== Installing test dependencies ==="
export PATH="/home/baudbot_agent/opt/node/bin:$PATH"
cd /home/baudbot_admin/baudbot
npm install --ignore-scripts 2>&1 | tail -1
cd broker-gateway && npm install 2>&1 | tail -1
cd ..
echo "=== Running tests ==="
bash bin/test.sh
echo ""
echo "✅ All checks passed on Arch Linux"