fix: bump Bun to 1.3.10 and harden startup for non-AVX CPUs (#213)

Bun 1.3.9 crashes with a segfault on CPUs without AVX support due to a
WASM IPInt bug (oven-sh/bun#27340), fixed in 1.3.10 via oven-sh/bun#26922.

- Bump Bun from 1.3.9 to 1.3.10 in Dockerfile, CI workflows, and packageManager
- Skip env config script when no GitHub/Gitea env vars are set
- Make startup scripts (env-config, recovery, repair) fault-tolerant so
  a crash in a non-critical script doesn't abort the entrypoint via set -e
This commit is contained in:
Arunavo Ray
2026-03-06 08:19:44 +05:30
parent 8a26764d2c
commit df3e665978
5 changed files with 33 additions and 24 deletions

View File

@@ -33,7 +33,7 @@ jobs:
- name: Setup Bun - name: Setup Bun
uses: oven-sh/setup-bun@v1 uses: oven-sh/setup-bun@v1
with: with:
bun-version: '1.3.6' bun-version: '1.3.10'
- name: Check lockfile and install dependencies - name: Check lockfile and install dependencies
run: | run: |

View File

@@ -40,7 +40,7 @@ env:
FAKE_GITHUB_PORT: 4580 FAKE_GITHUB_PORT: 4580
GIT_SERVER_PORT: 4590 GIT_SERVER_PORT: 4590
APP_PORT: 4321 APP_PORT: 4321
BUN_VERSION: "1.3.6" BUN_VERSION: "1.3.10"
jobs: jobs:
e2e-tests: e2e-tests:

View File

@@ -1,6 +1,6 @@
# syntax=docker/dockerfile:1.4 # syntax=docker/dockerfile:1.4
FROM oven/bun:1.3.9-debian AS base FROM oven/bun:1.3.10-debian AS base
WORKDIR /app WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends \ RUN apt-get update && apt-get install -y --no-install-recommends \
python3 make g++ gcc wget sqlite3 openssl ca-certificates \ python3 make g++ gcc wget sqlite3 openssl ca-certificates \
@@ -26,7 +26,7 @@ COPY bun.lock* ./
RUN bun install --production --omit=peer --frozen-lockfile RUN bun install --production --omit=peer --frozen-lockfile
# ---------------------------- # ----------------------------
FROM oven/bun:1.3.9-debian AS runner FROM oven/bun:1.3.10-debian AS runner
WORKDIR /app WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends \ RUN apt-get update && apt-get install -y --no-install-recommends \
git git-lfs wget sqlite3 openssl ca-certificates \ git git-lfs wget sqlite3 openssl ca-certificates \

View File

@@ -139,16 +139,29 @@ fi
# Initialize configuration from environment variables if provided # Initialize configuration from environment variables if provided
echo "Checking for environment configuration..." echo "Checking for environment configuration..."
if [ -f "dist/scripts/startup-env-config.js" ]; then
echo "Loading configuration from environment variables..." # Only run the env config script if relevant env vars are set
bun dist/scripts/startup-env-config.js # This avoids spawning a heavy Bun process on memory-constrained systems
ENV_CONFIG_EXIT_CODE=$? HAS_ENV_CONFIG=false
elif [ -f "scripts/startup-env-config.ts" ]; then if [ -n "$GITHUB_USERNAME" ] || [ -n "$GITHUB_TOKEN" ] || [ -n "$GITEA_URL" ] || [ -n "$GITEA_USERNAME" ] || [ -n "$GITEA_TOKEN" ]; then
echo "Loading configuration from environment variables..." HAS_ENV_CONFIG=true
bun scripts/startup-env-config.ts fi
ENV_CONFIG_EXIT_CODE=$?
if [ "$HAS_ENV_CONFIG" = "true" ]; then
if [ -f "dist/scripts/startup-env-config.js" ]; then
echo "Loading configuration from environment variables..."
bun dist/scripts/startup-env-config.js || ENV_CONFIG_EXIT_CODE=$?
ENV_CONFIG_EXIT_CODE=${ENV_CONFIG_EXIT_CODE:-0}
elif [ -f "scripts/startup-env-config.ts" ]; then
echo "Loading configuration from environment variables..."
bun scripts/startup-env-config.ts || ENV_CONFIG_EXIT_CODE=$?
ENV_CONFIG_EXIT_CODE=${ENV_CONFIG_EXIT_CODE:-0}
else
echo "Environment configuration script not found. Skipping."
ENV_CONFIG_EXIT_CODE=0
fi
else else
echo "Environment configuration script not found. Skipping." echo "No GitHub/Gitea environment variables found, skipping env config initialization."
ENV_CONFIG_EXIT_CODE=0 ENV_CONFIG_EXIT_CODE=0
fi fi
@@ -161,17 +174,15 @@ fi
# Run startup recovery to handle any interrupted jobs # Run startup recovery to handle any interrupted jobs
echo "Running startup recovery..." echo "Running startup recovery..."
RECOVERY_EXIT_CODE=0
if [ -f "dist/scripts/startup-recovery.js" ]; then if [ -f "dist/scripts/startup-recovery.js" ]; then
echo "Running startup recovery using compiled script..." echo "Running startup recovery using compiled script..."
bun dist/scripts/startup-recovery.js --timeout=30000 bun dist/scripts/startup-recovery.js --timeout=30000 || RECOVERY_EXIT_CODE=$?
RECOVERY_EXIT_CODE=$?
elif [ -f "scripts/startup-recovery.ts" ]; then elif [ -f "scripts/startup-recovery.ts" ]; then
echo "Running startup recovery using TypeScript script..." echo "Running startup recovery using TypeScript script..."
bun scripts/startup-recovery.ts --timeout=30000 bun scripts/startup-recovery.ts --timeout=30000 || RECOVERY_EXIT_CODE=$?
RECOVERY_EXIT_CODE=$?
else else
echo "Warning: Startup recovery script not found. Skipping recovery." echo "Warning: Startup recovery script not found. Skipping recovery."
RECOVERY_EXIT_CODE=0
fi fi
# Log recovery result # Log recovery result
@@ -185,17 +196,15 @@ fi
# Run repository status repair to fix any inconsistent mirroring states # Run repository status repair to fix any inconsistent mirroring states
echo "Running repository status repair..." echo "Running repository status repair..."
REPAIR_EXIT_CODE=0
if [ -f "dist/scripts/repair-mirrored-repos.js" ]; then if [ -f "dist/scripts/repair-mirrored-repos.js" ]; then
echo "Running repository repair using compiled script..." echo "Running repository repair using compiled script..."
bun dist/scripts/repair-mirrored-repos.js --startup bun dist/scripts/repair-mirrored-repos.js --startup || REPAIR_EXIT_CODE=$?
REPAIR_EXIT_CODE=$?
elif [ -f "scripts/repair-mirrored-repos.ts" ]; then elif [ -f "scripts/repair-mirrored-repos.ts" ]; then
echo "Running repository repair using TypeScript script..." echo "Running repository repair using TypeScript script..."
bun scripts/repair-mirrored-repos.ts --startup bun scripts/repair-mirrored-repos.ts --startup || REPAIR_EXIT_CODE=$?
REPAIR_EXIT_CODE=$?
else else
echo "Warning: Repository repair script not found. Skipping repair." echo "Warning: Repository repair script not found. Skipping repair."
REPAIR_EXIT_CODE=0
fi fi
# Log repair result # Log repair result

View File

@@ -119,5 +119,5 @@
"tsx": "^4.21.0", "tsx": "^4.21.0",
"vitest": "^4.0.18" "vitest": "^4.0.18"
}, },
"packageManager": "bun@1.3.3" "packageManager": "bun@1.3.10"
} }