Skip to content

Commit 33a11ae

Browse files
fix(ci): Parse --ci flag before non-interactive check
- Move CI_MODE parsing to top of script before TTY check - Update CI test to properly verify --ci flag works - Use timeout to prevent hanging on interactive prompts
1 parent 2a8800a commit 33a11ae

2 files changed

Lines changed: 28 additions & 10 deletions

File tree

.github/workflows/ci.yml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,22 @@ jobs:
5353
- name: Verify install.sh syntax
5454
run: bash -n install.sh
5555

56-
- name: Test --ci flag parsing
56+
- name: Test --ci flag is recognized
5757
run: |
58-
# Verify the script accepts --ci flag and outputs CI mode message
59-
# Note: We can't run the full install in CI, just test parsing
60-
bash -c 'source <(head -120 install.sh); echo "CI_MODE=$CI_MODE"'
58+
# Test that --ci flag prevents the non-interactive exit
59+
# The script will fail on missing deps (brew/apt), but should NOT fail with "NON-INTERACTIVE MODE NOT SUPPORTED"
60+
output=$(timeout 5 bash install.sh --ci 2>&1 || true)
6161
62-
# Test that command_exists function works
63-
bash -c '
64-
source <(sed -n "117,120p" install.sh)
65-
command_exists bash && echo "command_exists: OK"
66-
'
62+
if echo "$output" | grep -q "NON-INTERACTIVE MODE NOT SUPPORTED"; then
63+
echo "ERROR: --ci flag not working - script still requires interactive mode"
64+
exit 1
65+
fi
66+
67+
if echo "$output" | grep -q "Running in CI mode"; then
68+
echo "SUCCESS: --ci flag recognized"
69+
else
70+
echo "WARNING: CI mode message not found, but non-interactive error also not present"
71+
fi
72+
73+
echo "Output preview:"
74+
echo "$output" | head -20

install.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,16 @@
2525
# CI mode (non-interactive):
2626
# bash install.sh --ci Run in CI mode with defaults, no prompts, temp directory vault
2727

28+
# Parse --ci flag FIRST (before any checks that might exit)
29+
# This allows CI mode to bypass the non-interactive check
30+
CI_MODE=false
31+
for arg in "$@"; do
32+
if [ "$arg" = "--ci" ]; then
33+
CI_MODE=true
34+
break
35+
fi
36+
done
37+
2838
# Create log file FIRST (before anything else)
2939
LOG_FILE="/tmp/interbrain-install-$(date +%Y%m%d-%H%M%S).log"
3040

@@ -91,7 +101,7 @@ DREAMER_UUID=""
91101
BRANCH="main" # Default to main branch
92102
TEST_FAIL=""
93103
TEST_RADICLE_FALLBACK=false
94-
CI_MODE=false
104+
# CI_MODE already parsed above before non-interactive check
95105
while [[ $# -gt 0 ]]; do
96106
case $1 in
97107
--uri)

0 commit comments

Comments
 (0)