forked from mtusi2026/mtusi2026lab3
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) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V1d3RLHNBBMA6UqBLLJv27
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
d99a48a5db
commit
fb6ff87bb3
@@ -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: |
|
||||
|
||||
@@ -77,6 +77,7 @@ secrets:
|
||||
|
||||
up: secrets
|
||||
$(COMPOSE) up -d --build --wait
|
||||
scripts/lb-wait.sh
|
||||
|
||||
down:
|
||||
$(COMPOSE) --profile bench down
|
||||
|
||||
@@ -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. Обвязка доказательств
|
||||
|
||||
|
||||
Reference in New Issue
Block a user