From fb6ff87bb3879a0cde493e0a596e8628cee4072c Mon Sep 17 00:00:00 2001 From: Artyom Date: Fri, 30 Oct 2026 05:41:13 +0300 Subject: [PATCH] Wait for every replica in make up and check numeric uids in CI compose up --wait returns once lb is healthy, and lb is healthy with one replica in rotation; the second one joins after rise 2 checks, about 2.5 s later, so make test-failover right after make up could see a single X-Instance-Id. make up now runs scripts/lb-wait.sh, which waits for as many UP servers as there are running api containers. The CI non-root step compared the third column of docker compose top with 0, but the daemon prints the user name there (root), so it could never fail. It now reads the numeric uid of every process of every container with docker top -eo pid,uid,comm (Docker needs the PID column); a throwaway root container makes the check fail. Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01V1d3RLHNBBMA6UqBLLJv27 --- .github/workflows/application.yml | 4 +++- Makefile | 1 + openspec/changes/close-lab3-second-review-gaps/tasks.md | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/application.yml b/.github/workflows/application.yml index bae9be48..e92b653a 100644 --- a/.github/workflows/application.yml +++ b/.github/workflows/application.yml @@ -61,7 +61,9 @@ jobs: - name: Процессы работают не от root run: | - docker compose top | awk 'NR>1 && $3=="0" {print; bad=1} END {exit bad}' + for id in $(docker compose ps -q); do + docker top "$id" -eo pid,uid,comm | awk 'NR>1 && $2==0 {print; bad=1} END {exit bad}' || exit 1 + done - name: Корректная остановка реплик API по SIGTERM run: | diff --git a/Makefile b/Makefile index 74fd3fde..7f7e8426 100644 --- a/Makefile +++ b/Makefile @@ -77,6 +77,7 @@ secrets: up: secrets $(COMPOSE) up -d --build --wait + scripts/lb-wait.sh down: $(COMPOSE) --profile bench down diff --git a/openspec/changes/close-lab3-second-review-gaps/tasks.md b/openspec/changes/close-lab3-second-review-gaps/tasks.md index 1e5546bd..9b2a5865 100644 --- a/openspec/changes/close-lab3-second-review-gaps/tasks.md +++ b/openspec/changes/close-lab3-second-review-gaps/tasks.md @@ -9,9 +9,9 @@ ## 2. Стенд и CI -- [ ] 2.1 `make up` ждёт все реплики в LB (`scripts/lb-wait.sh`) +- [x] 2.1 `make up` ждёт все реплики в LB (`scripts/lb-wait.sh`) - [ ] 2.2 CI: non-root по числовому uid `docker top -eo pid,uid,comm`; шаг `make retry-check` -- [ ] 2.3 Проверка группы: `make up` и сразу `make test-failover ACTION_SCRIPT=scripts/stop-one.sh`; проверка non-root на стенде и на контейнере от root +- [x] 2.3 Проверка группы: `make up` и сразу `make test-failover ACTION_SCRIPT=scripts/stop-one.sh`; проверка non-root на стенде и на контейнере от root ## 3. Обвязка доказательств