문제: 앞 커밋이 Gradle 루트를 저장소 루트로 옮기고 계층 폴더를 묶었다.
빌드 스크립트·build-logic·시험·workflow·스크립트·문서가 아직 옛 배치
(Gradle 루트 = src/)를 가정해 빌드가 되지 않는다.
고른 방법:
- Gradle 경로와 registry id는 그대로 둔다(:app-bootstrap, :application-core,
:composition:*). registry의 source_path만 새 폴더를 가리킨다. 폴더에 맞춘
이름(:domain:core, :application:core)은 프로젝트 이름 core가 둘이 되어
boot jar의 BOOT-INF/lib와 기본 capability가 겹치고, 파생 서비스의 모든
project(':…') 줄을 바꾸게 한다.
- registry는 gradle/modules.json, 시험 이미지 목록은
gradle/container-images.properties: 버전 카탈로그 옆, 빌드가 고정하는 것.
config/는 코드 검사 도구 설정만 둔다.
- build-logic: settings·architecture 플러그인의 저장소 루트를 Gradle 루트로
(getParentFile 제거). config contract의 파일 트리는 src/만 훑는다(루트를
훑으면 docs·.claude/worktrees까지 줍는다).
- 빌드 스크립트: rootProject.projectDir.parentFile → rootProject.projectDir,
rootProject.file('../…') → rootProject.file('…'), 옛 src 기준 include에
src/를 붙인다. notification API surface의 application-notification 소스
루트를 새 폴더로(놓치면 272개 타입이 surface에서 말없이 빠진다).
- 시험: 옛 src 기준 모듈 목록과 ../ 개수를 고친다. 없는 폴더를 말없이
건너뛰던 목록(MessagingAuthority, NotificationPayloadAtRest 등)을 새
폴더로, FileserverDocumentationCoverageTest는 Gradle 경로 → 폴더를
registry로 찾는다. Docker 계약은 WORKDIR /build, 새 jar 경로.
- Docker: 빌드 context를 저장소 루트로, .dockerignore는 허용 목록으로 다시
써서 전에 context였던 것만 들어가게 한다. compose의 build.context는 .,
env_file은 ./.env.
- workflow: working-directory: src 기본값과 그것을 되돌리던 줄을 지운다.
- scripts: verify.sh, ci/*, bootstrap-local, new-feature,
verify-feature-scaffold, mongo 검증, hooks, check-repo-layout 허용 목록.
check-docs의 경로 검사는 build-logic/·gradle/로 시작하는 경로도 본다.
- 문서: AGENTS.md 지도, README 구조 표, leaf AGENTS.md의 cd src, gates·
operate·결정 색인, src/bootstrap/AGENTS.md를 조립 계층 family 규칙으로
다시 쓴다. 기록 문서(docs/design·history·reviews, 지난 upgrade 안내,
capability-status 제거 표)는 머리 블록만 고친다. 파생 서비스용 안내
docs/upgrade/2026-11-relayout.md를 더한다.
위험: bootRun working dir가 저장소 루트가 되어 .env와 상대 경로 설정이
루트 기준이다. 루트 .env는 compose 보간에도 읽힌다(upgrade 안내 5절).
파생 서비스는 태그 pre-relayout-2026-11까지 받은 뒤 이 묶음을 받는다.
검증: desktop에서 캐시 없이 scripts/verify.sh docs·pr·main·release,
compose smoke 18 lane, 빠른 시작(scripts/verify.sh app). 결과는 PR 본문.
구조 리뷰(arch-reviewer) 지적 5건을 반영했다.
BREAKING CHANGE: Gradle은 저장소 루트에서 돈다(cd src 없음). registry는
gradle/modules.json, 이미지 빌드 context는 저장소 루트다. 옛 경로 → 새 경로
표는 docs/upgrade/2026-11-relayout.md.
Refs: design-docs repo-structure/01-backend-layout.md 6.1절 가-2·가-3
178 lines
7.1 KiB
Bash
Executable File
178 lines
7.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# The MongoDB Stable release gate (design §30, plan Task 50).
|
|
#
|
|
# Runs every lane that produces one of the Stable evidence categories:
|
|
#
|
|
# mapping, transaction, migration, change-stream, security,
|
|
# failover, performance, compatibility
|
|
#
|
|
# The gate exists because "the test suite is green" and "every category has evidence" are different
|
|
# statements. A suite passes happily with a whole lane skipped -- no Docker, a disabled tag, a
|
|
# renamed task -- and a release built on that suite has no failover or compatibility evidence at
|
|
# all, silently. Each lane below is therefore run by name, and a skipped lane is reported as skipped
|
|
# rather than counted as passed.
|
|
#
|
|
# Advanced capabilities are NOT promoted or transitively included here. See
|
|
# scripts/verify-mongodb-advanced.sh.
|
|
#
|
|
# Usage:
|
|
# bash scripts/verify-mongodb-platform.sh # hermetic lanes only
|
|
# MONGODB_DOCKER=1 bash scripts/verify-mongodb-platform.sh # + container lanes
|
|
#
|
|
set -euo pipefail
|
|
|
|
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
GRADLE_DIR="${REPO_ROOT}"
|
|
MODULE=':adapter:outbound:persistence-mongo'
|
|
GRADLE=(./gradlew --console=plain)
|
|
|
|
RESULTS_DIR="${GRADLE_DIR}/src/adapter/outbound/persistence-mongo/build/test-results"
|
|
|
|
RAN=()
|
|
SKIPPED=()
|
|
FAILED=()
|
|
|
|
# Counts the tests a lane actually executed, from its JUnit XML.
|
|
#
|
|
# A lane whose filter matches nothing passes: Gradle runs the task, discovers no tests, and reports
|
|
# success. That is the failure mode this whole gate exists to prevent -- an empty lane is not
|
|
# evidence, it is the absence of evidence wearing a green tick. Any lane that reports zero executed
|
|
# tests is treated as a failure.
|
|
executed_tests() {
|
|
local task="$1"
|
|
local dir="${RESULTS_DIR}/${task}"
|
|
[[ -d "${dir}" ]] || { echo 0; return; }
|
|
local total=0
|
|
shopt -s nullglob
|
|
for xml in "${dir}"/*.xml; do
|
|
local count
|
|
count=$(sed -n 's/.*<testsuite[^>]* tests="\([0-9]*\)".*/\1/p' "${xml}" | head -1)
|
|
total=$(( total + ${count:-0} ))
|
|
done
|
|
shopt -u nullglob
|
|
echo "${total}"
|
|
}
|
|
|
|
run_lane() {
|
|
local category="$1"
|
|
local task="$2"
|
|
shift 2
|
|
echo ""
|
|
echo "=== [${category}] ${task}"
|
|
if ! (cd "${GRADLE_DIR}" && "${GRADLE[@]}" "${MODULE}:${task}" "$@"); then
|
|
FAILED+=("${category}:${task}")
|
|
return
|
|
fi
|
|
# `check` aggregates several tasks and has no results directory of its own.
|
|
if [[ "${task}" == "check" ]]; then
|
|
RAN+=("${category}:${task}")
|
|
return
|
|
fi
|
|
local executed
|
|
executed=$(executed_tests "${task}")
|
|
if (( executed == 0 )); then
|
|
echo "!!! ${task} passed without executing a single test — the lane's filter matches nothing,"
|
|
echo "!!! so the '${category}' evidence category is empty."
|
|
FAILED+=("${category}:${task} (0 tests executed)")
|
|
else
|
|
RAN+=("${category}:${task} (${executed} tests)")
|
|
fi
|
|
}
|
|
|
|
skip_lane() {
|
|
local category="$1"
|
|
local task="$2"
|
|
local reason="$3"
|
|
echo ""
|
|
echo "=== [${category}] ${task} -- SKIPPED (${reason})"
|
|
SKIPPED+=("${category}:${task} (${reason})")
|
|
}
|
|
|
|
docker_available() {
|
|
[[ "${MONGODB_DOCKER:-0}" == "1" ]] && command -v docker >/dev/null 2>&1 && docker info >/dev/null 2>&1
|
|
}
|
|
|
|
echo "MongoDB Stable release gate"
|
|
echo "repository: ${REPO_ROOT}"
|
|
|
|
# --- Always-on lanes -------------------------------------------------------------------------
|
|
# Static analysis, architecture boundaries, unit and hermetic contract tests. These produce the
|
|
# mapping, transaction, migration, change-stream and security evidence that does not need a server.
|
|
run_lane "static-analysis" "check" -x "mongoStableContractTest"
|
|
run_lane "mapping+transaction+migration+change-stream+security" "mongoStableContractTest"
|
|
|
|
# --- Container lanes -------------------------------------------------------------------------
|
|
# A lane that needs Docker inside `check` teaches people to skip `check`, so these are opt-in --
|
|
# but opting out is recorded, not silent.
|
|
if docker_available; then
|
|
run_lane "compatibility" "mongoCompatibilityTest"
|
|
run_lane "migration" "mongoMigrationTest"
|
|
run_lane "security" "mongoSecurityIntegrationTest"
|
|
run_lane "failover" "mongoReplicaSetTest"
|
|
run_lane "failover" "mongoFailoverTest"
|
|
run_lane "performance" "mongoPerformanceTest"
|
|
else
|
|
reason="MONGODB_DOCKER!=1 or Docker unavailable"
|
|
skip_lane "compatibility" "mongoCompatibilityTest" "${reason}"
|
|
skip_lane "migration" "mongoMigrationTest" "${reason}"
|
|
skip_lane "security" "mongoSecurityIntegrationTest" "${reason}"
|
|
skip_lane "failover" "mongoReplicaSetTest" "${reason}"
|
|
skip_lane "failover" "mongoFailoverTest" "${reason}"
|
|
skip_lane "performance" "mongoPerformanceTest" "${reason}"
|
|
fi
|
|
|
|
# --- Architecture-wide gates -----------------------------------------------------------------
|
|
echo ""
|
|
echo "=== [architecture] repository-wide verification"
|
|
if (cd "${GRADLE_DIR}" \
|
|
&& "${GRADLE[@]}" verifyCleanArchitectureDependencies \
|
|
&& "${GRADLE[@]}" :app-bootstrap:test --tests '*CleanArchitectureTest'); then
|
|
RAN+=("architecture:repository-wide")
|
|
else
|
|
FAILED+=("architecture:repository-wide")
|
|
fi
|
|
|
|
# --- Report ------------------------------------------------------------------------------------
|
|
echo ""
|
|
echo "---------------------------------------------------------------"
|
|
echo "ran: ${#RAN[@]}"
|
|
for entry in "${RAN[@]:-}"; do [[ -n "${entry}" ]] && echo " + ${entry}"; done
|
|
echo "skipped: ${#SKIPPED[@]}"
|
|
for entry in "${SKIPPED[@]:-}"; do [[ -n "${entry}" ]] && echo " ~ ${entry}"; done
|
|
echo "failed: ${#FAILED[@]}"
|
|
for entry in "${FAILED[@]:-}"; do [[ -n "${entry}" ]] && echo " - ${entry}"; done
|
|
|
|
# --- promotion manifest -------------------------------------------------------------------------
|
|
# What was actually certified, tied to what produced it. A gate output that says "PASSED" and
|
|
# nothing else cannot be checked later against the artefact it supposedly certified: the commit, the
|
|
# server image and the driver version are exactly what somebody reads during an incident.
|
|
MANIFEST_DIR="${REPO_ROOT}/src/adapter/outbound/persistence-mongo/build/reports/mongo-release"
|
|
mkdir -p "${MANIFEST_DIR}"
|
|
{
|
|
echo "{"
|
|
echo " \"commit\": \"$(git -C "${REPO_ROOT}" rev-parse HEAD)\","
|
|
echo " \"commitDirty\": $( [[ -n "$(git -C "${REPO_ROOT}" status --porcelain)" ]] && echo true || echo false ),"
|
|
echo " \"serverImage\": \"${MONGODB_IMAGE:-mongo:8.0.16}\","
|
|
echo " \"generatedAt\": \"$(date -u +%Y-%m-%dT%H:%M:%SZ)\","
|
|
echo " \"contractManifest\": \"src/adapter/outbound/persistence-mongo/release/release-contracts.json\","
|
|
echo " \"contractManifestSha256\": \"$(sha256sum "${REPO_ROOT}/src/adapter/outbound/persistence-mongo/release/release-contracts.json" | cut -d' ' -f1)\""
|
|
echo "}"
|
|
} > "${MANIFEST_DIR}/promotion.json"
|
|
echo "promotion manifest: ${MANIFEST_DIR}/promotion.json"
|
|
|
|
echo "---------------------------------------------------------------"
|
|
|
|
if (( ${#FAILED[@]} > 0 )); then
|
|
echo "STABLE GATE: FAILED"
|
|
exit 1
|
|
fi
|
|
|
|
if (( ${#SKIPPED[@]} > 0 )); then
|
|
echo "STABLE GATE: INCOMPLETE -- lanes above were not run, so their evidence categories are absent."
|
|
echo "A release requires every category. Re-run with MONGODB_DOCKER=1 on a host with Docker."
|
|
exit 2
|
|
fi
|
|
|
|
echo "STABLE GATE: PASSED -- every evidence category produced."
|