From 9bca465565f519598cf03f031d9657c4cdd5a9bf Mon Sep 17 00:00:00 2001 From: Daniel Samson <12231216+daniel-samson@users.noreply.github.com> Date: Sun, 12 Apr 2026 14:47:48 +0100 Subject: [PATCH] Skip build for lightweight stages (analyse, architect, release, maintenance) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These stages only read code and post comments — no need for npm install, frontend build, Playwright, or migrations. Saves several minutes. Co-Authored-By: Claude Opus 4.6 --- coder/cloudflare-worker/main.tf | 38 +++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/coder/cloudflare-worker/main.tf b/coder/cloudflare-worker/main.tf index 9e1a90b..cceb92f 100644 --- a/coder/cloudflare-worker/main.tf +++ b/coder/cloudflare-worker/main.tf @@ -460,25 +460,31 @@ resource "coder_agent" "main" { # Switch to develop branch if it exists git fetch origin develop 2>/dev/null && git checkout develop 2>/dev/null || true - # Install deps if package.json exists - if [ -f package.json ]; then - npm ci --legacy-peer-deps || npm ci - fi + # Lightweight stages only need the code, not a full build + LIGHT_STAGES="analyse architect release maintenance" + if echo "$LIGHT_STAGES" | grep -qw "$TASK_TYPE"; then + echo "Lightweight stage ($TASK_TYPE) — skipping build" + else + # Install deps if package.json exists + if [ -f package.json ]; then + npm ci --legacy-peer-deps || npm ci + fi - # Install frontend deps if present - if [ -f frontend/package.json ]; then - cd frontend && npm ci && cd .. - npm run build:frontend 2>/dev/null || true - fi + # Install frontend deps if present + if [ -f frontend/package.json ]; then + cd frontend && npm ci && cd .. + npm run build:frontend 2>/dev/null || true + fi - # Install Playwright if needed - if grep -q "playwright" package.json 2>/dev/null; then - npx playwright install chromium - fi + # Install Playwright if needed + if grep -q "playwright" package.json 2>/dev/null; then + npx playwright install chromium + fi - # Apply local migrations if script exists - if npm run --silent db:migrate:local 2>/dev/null; then - echo "Local migrations applied" + # Apply local migrations if script exists + if npm run --silent db:migrate:local 2>/dev/null; then + echo "Local migrations applied" + fi fi fi