Files
clean-architecture-backend-…/scripts/bootstrap-local.sh
T
donghyeon-kaandClaude Opus 5.5 0ed7bc8df7 review-followup Wave 3 라운드 1(P16): 빌드 게이트 정리 — JPA evidence manifest 폐기, build-tools 제거, API surface를 leaf check로
- 결정 4: JPA evidence·qualification manifest 폐기 → persistence-jpa 테스트, build-tools included build 비움(verifyEnvKeys는
  app-bootstrap 태스크, 구현은 build-logic `ca.config-contract`), gRPC release gate 삭제
- 결정 20: API surface 검사를 leaf `check`로, JPA adopter 검사를 `ca.api-surface`로 합침(구현 하나)
- 레인 단계 정리(문서 대조 레인은 `mainStage()`), integrationCheck가 입력 없는 레인을 이름과 함께 제외 → 로컬 통과(NEW-16)
- release workflow 통합, releaseCheck는 tag 전용, build-logic 비핵심 플러그인 정리, sample을 ArchUnit 대상에
- 보류 4행(B3 변경 모듈만 실행, C 이미지 서명, messaging 카드 검증 이동 2행 — 결정 필요), 남음 2행(O3-5 나머지)
- 통합: P17이 옮긴 gRPC release gate 사본 삭제, `grpc-proto-buf`를 release-gate needs에(P17-new-3)

검증: ./gradlew ci verifyDependencyLocks --warning-mode=fail 통과(685 task), mainCheck 통과(268 task),
-p optional-platforms ci 통과, -p build-logic test 78건 통과(손상된 TestKit 캐시 삭제 후)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-28 16:44:17 +09:00

64 lines
2.9 KiB
Bash
Executable File

#!/usr/bin/env bash
# The ordered local start-up: compile, Docker preflight, dependency wait, migrate-and-start, smoke.
#
# scripts/bootstrap-local.sh # the `local` overlay (docker-compose.local.yml)
# scripts/bootstrap-local.sh <profile> # docker-compose.<profile>.yml merged onto docker-compose.yml
#
# This was the build-logic `ca.developer-bootstrap` plugin (`./gradlew bootstrap`). Starting
# containers and probing an HTTP endpoint is not a build rule, so it is a script now (review
# 2026-09-24 BUILD-O3-5). The four stages and their order are unchanged: the next stage starts only
# when the previous one succeeded, and the app stage waits for startup Flyway through the compose
# healthcheck before the smoke probe runs.
set -euo pipefail
readonly repository_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
readonly profile="${1:-local}"
readonly base_compose="${repository_dir}/docker-compose.yml"
readonly overlay="${repository_dir}/docker-compose.${profile}.yml"
readonly health_endpoint="${BOOTSTRAP_HEALTH_ENDPOINT:-http://localhost:8080/api/healthcheck}"
readonly smoke_timeout_seconds="${BOOTSTRAP_SMOKE_TIMEOUT_SECONDS:-60}"
if [[ ! -f "${overlay}" ]]; then
available="$(cd "${repository_dir}" && ls docker-compose.*.yml 2>/dev/null \
| sed -e 's/^docker-compose\.//' -e 's/\.yml$//' | tr '\n' ' ')"
echo "bootstrap: '${profile}' names no overlay; expected $(basename "${overlay}") beside" \
"docker-compose.yml. Available: ${available:-none}" >&2
exit 64
fi
compose=(docker compose -f "${base_compose}" -f "${overlay}")
echo "bootstrap 1/4: compiling the default application composition"
(cd "${repository_dir}/src" && ./gradlew :app-bootstrap:compileTestJava --console=plain)
if ! docker info >/dev/null 2>&1; then
echo "bootstrap: Docker가 필요합니다. Docker Desktop/daemon을 시작한 뒤 \`docker info\`가 성공하는지 확인하세요." >&2
exit 69
fi
echo "bootstrap 2/4: starting the ${profile} PostgreSQL dependency and waiting for readiness"
"${compose[@]}" up -d --wait db
echo "bootstrap 3/4: building and starting the app; startup Flyway finishes before health is ready"
"${compose[@]}" up -d --build --wait app
echo "bootstrap 4/4: requiring HTTP 200 and status=UP from ${health_endpoint}"
deadline=$((SECONDS + smoke_timeout_seconds))
last_result="no response"
while ((SECONDS < deadline)); do
if body="$(curl --silent --show-error --max-time 2 --write-out '\n%{http_code}' "${health_endpoint}" 2>&1)"; then
status="${body##*$'\n'}"
body="${body%$'\n'*}"
if [[ "${status}" == "200" && "${body}" == *'"status":"UP"'* ]]; then
echo "bootstrap: OK — ${health_endpoint} returned HTTP 200 and status=UP."
exit 0
fi
last_result="HTTP ${status}: ${body}"
else
last_result="${body}"
fi
sleep 1
done
echo "bootstrap: ${health_endpoint} did not become healthy within ${smoke_timeout_seconds}s;" \
"last result: ${last_result}" >&2
exit 1