Widen scratch iteration 011 with fixture-backed integrations QA

This commit is contained in:
master
2026-03-14 03:11:45 +02:00
parent 3b1b7dad80
commit bd78523564
40 changed files with 3478 additions and 2173 deletions

View File

@@ -11,6 +11,7 @@ SKIP_BUILD=false
INFRA_ONLY=false
IMAGES_ONLY=false
SKIP_IMAGES=false
QA_INTEGRATION_FIXTURES=false
for arg in "$@"; do
case "$arg" in
@@ -18,8 +19,9 @@ for arg in "$@"; do
--infra-only) INFRA_ONLY=true ;;
--images-only) IMAGES_ONLY=true ;;
--skip-images) SKIP_IMAGES=true ;;
--qa-integration-fixtures) QA_INTEGRATION_FIXTURES=true ;;
-h|--help)
echo "Usage: $0 [--skip-build] [--infra-only] [--images-only] [--skip-images]"
echo "Usage: $0 [--skip-build] [--infra-only] [--images-only] [--skip-images] [--qa-integration-fixtures]"
exit 0
;;
*) echo "Unknown flag: $arg" >&2; exit 1 ;;
@@ -326,16 +328,9 @@ check_prerequisites() {
# ─── 2. Check and install hosts file ─────────────────────────────────────
check_hosts() {
step 'Checking hosts file for stella-ops.local entries'
step 'Checking hosts file for required Stella Ops entries'
local hosts_source="${ROOT}/devops/compose/hosts.stellaops.local"
if grep -q 'stella-ops\.local' /etc/hosts 2>/dev/null; then
ok 'stella-ops.local entries found in /etc/hosts'
return
fi
warn 'stella-ops.local entries NOT found in /etc/hosts.'
if [[ ! -f "$hosts_source" ]]; then
warn "Hosts source file not found at $hosts_source"
echo ' Add the hosts block from docs/dev/DEV_ENVIRONMENT_SETUP.md section 2'
@@ -343,6 +338,42 @@ check_hosts() {
return
fi
local source_lines=()
while IFS= read -r line; do
[[ -z "${line// }" ]] && continue
[[ "$line" =~ ^[[:space:]]*# ]] && continue
source_lines+=("$line")
done < "$hosts_source"
local missing_lines=()
local missing_hosts=()
local line hostname
for line in "${source_lines[@]}"; do
read -r -a tokens <<< "$line"
(( ${#tokens[@]} < 2 )) && continue
local line_missing=false
for hostname in "${tokens[@]:1}"; do
if ! grep -Eq "(^|[[:space:]])${hostname}($|[[:space:]])" /etc/hosts 2>/dev/null; then
missing_hosts+=("$hostname")
line_missing=true
fi
done
if [[ "$line_missing" == "true" ]]; then
missing_lines+=("$line")
fi
done
if (( ${#missing_hosts[@]} == 0 )); then
ok 'All required Stella Ops host entries are present in /etc/hosts'
return
fi
local unique_missing_hosts
unique_missing_hosts=$(printf '%s\n' "${missing_hosts[@]}" | awk 'NF { print }' | sort -u | paste -sd ', ' -)
warn "Missing Stella Ops host aliases: ${unique_missing_hosts}"
echo ''
echo ' Stella Ops needs ~50 hosts file entries for local development.'
echo " Source: devops/compose/hosts.stellaops.local"
@@ -353,21 +384,21 @@ check_hosts() {
if [[ -z "$answer" || "$answer" =~ ^[Yy] ]]; then
if [[ "$(id -u)" -eq 0 ]]; then
printf '\n' >> /etc/hosts
cat "$hosts_source" >> /etc/hosts
ok 'Hosts entries added successfully'
printf '%s\n' "${missing_lines[@]}" >> /etc/hosts
ok "Added ${#missing_lines[@]} missing host entry line(s) successfully"
else
echo ''
echo ' Adding hosts entries requires sudo...'
if sudo sh -c "printf '\n' >> /etc/hosts && cat '$hosts_source' >> /etc/hosts"; then
ok 'Hosts entries added successfully'
if printf '%s\n' "${missing_lines[@]}" | sudo tee -a /etc/hosts >/dev/null; then
ok "Added ${#missing_lines[@]} missing host entry line(s) successfully"
else
warn 'Failed to add hosts entries. Add them manually:'
echo " sudo sh -c 'cat $hosts_source >> /etc/hosts'"
echo " printf '%s\n' \"${missing_lines[@]}\" | sudo tee -a /etc/hosts"
fi
fi
else
warn 'Skipped. Add them manually before accessing the platform:'
echo " sudo sh -c 'cat $hosts_source >> /etc/hosts'"
printf ' %s\n' "${missing_lines[@]}"
fi
}
@@ -486,6 +517,15 @@ start_platform() {
wait_for_compose_convergence 'Platform services converged from zero-state startup' true 180 45 docker-compose.stella-ops.yml || true
}
start_qa_integration_fixtures() {
step 'Starting QA integration fixtures'
cd "$COMPOSE_DIR"
docker compose -f docker-compose.integration-fixtures.yml up -d
ok 'QA integration fixtures started'
cd "$ROOT"
wait_for_compose_convergence 'QA integration fixtures are healthy' false 90 30 docker-compose.integration-fixtures.yml || true
}
http_status() {
local url="$1"
local attempts="${2:-6}"
@@ -597,6 +637,25 @@ smoke_test() {
has_blocking_failures=true
fi
if [[ "$QA_INTEGRATION_FIXTURES" == "true" ]]; then
local harbor_fixture_status github_fixture_status
harbor_fixture_status=$(http_status 'http://127.1.1.6/api/v2.0/health')
if [[ "$harbor_fixture_status" == "200" ]]; then
ok "Harbor QA fixture (HTTP $harbor_fixture_status)"
else
warn 'Harbor QA fixture did not respond with HTTP 200 on /api/v2.0/health'
has_blocking_failures=true
fi
github_fixture_status=$(http_status 'http://127.1.1.7/api/v3/app')
if [[ "$github_fixture_status" == "200" ]]; then
ok "GitHub App QA fixture (HTTP $github_fixture_status)"
else
warn 'GitHub App QA fixture did not respond with HTTP 200 on /api/v3/app'
has_blocking_failures=true
fi
fi
if [[ "$INFRA_ONLY" != "true" ]]; then
if ! frontdoor_bootstrap_ready; then
has_blocking_failures=true
@@ -614,8 +673,19 @@ smoke_test() {
local total=0
local healthy=0
local unhealthy_names=""
local compose_files=()
for cf in docker-compose.dev.yml docker-compose.stella-ops.yml; do
if [[ "$INFRA_ONLY" == "true" ]]; then
compose_files+=(docker-compose.dev.yml)
else
compose_files+=(docker-compose.stella-ops.yml)
fi
if [[ "$QA_INTEGRATION_FIXTURES" == "true" ]]; then
compose_files+=(docker-compose.integration-fixtures.yml)
fi
for cf in "${compose_files[@]}"; do
[[ ! -f "$cf" ]] && continue
while IFS= read -r line; do
[[ -z "$line" ]] && continue
@@ -676,6 +746,9 @@ ensure_env
start_infra
if [[ "$INFRA_ONLY" == "true" ]]; then
if [[ "$QA_INTEGRATION_FIXTURES" == "true" ]]; then
start_qa_integration_fixtures
fi
if ! smoke_test; then
fail 'Infrastructure setup did not pass blocking smoke tests. Review output and docker compose logs.'
exit 1
@@ -698,6 +771,9 @@ if [[ "$SKIP_IMAGES" != "true" ]]; then
fi
start_platform
if [[ "$QA_INTEGRATION_FIXTURES" == "true" ]]; then
start_qa_integration_fixtures
fi
if ! smoke_test; then
fail 'Setup did not pass blocking smoke tests. Review output and docker compose logs.'
exit 1
@@ -707,6 +783,10 @@ echo ''
echo '============================================='
echo ' Setup complete!'
echo ' Platform: https://stella-ops.local'
if [[ "$QA_INTEGRATION_FIXTURES" == "true" ]]; then
echo ' Harbor QA fixture: http://harbor-fixture.stella-ops.local/api/v2.0/health'
echo ' GitHub App QA fixture: http://github-app-fixture.stella-ops.local/api/v3/app'
fi
echo ' Docs: docs/dev/DEV_ENVIRONMENT_SETUP.md'
echo '============================================='
exit 0