Files
mtusi2026lab4/.github/ci/stand-env.sh
T
ricoromaandClaude Opus 5.5 d947781591 docs: complete lab 4 report and add the application CI job
- fill the skeleton sections of REPORT.md: author and target grade,
  launch from a clean clone, architecture and variable mapping, open
  questions to the teacher, limitations, sources and AI use
- add evidence/tests/clean-clone-final.md: clean clone of de98d77
- add .github/workflows/application.yml (CONTRIBUTING.md, CI) and the
  .github/ci/ override for the Gitea runner: configs instead of bind
  mounts, no host ports; evidence/tests/ci-application.md
- remove PLAN.md now that all changes are archived; point AGENTS.md
  and the rules at REPORT.md

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 18:12:55 +03:00

39 lines
1.9 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Окружение шага job application (.github/workflows/application.yml),
# подключается через «.» из корня репозитория после make env_setup.
# Содержимое конфигов — в переменные для configs override
# .github/ci/compose.yml. $(cat …) срезает перевод строки в конце файла,
# поэтому он возвращается: копия побайтно равна файлу, а HAProxy без него
# конфиг не принимает («Missing LF on last line»). Значения не печатаются.
nl='
'
CI_CONFIG_TOML="$(cat config.toml)$nl"
CI_VALKEY_CONF="$(cat infra/valkey/valkey.conf)$nl"
CI_S3_BOOTSTRAP="$(cat infra/s3/bootstrap.sh)$nl"
CI_HAPROXY_CFG="$(cat infra/haproxy/haproxy.cfg)$nl"
export CI_CONFIG_TOML CI_VALKEY_CONF CI_S3_BOOTSTRAP CI_HAPROXY_CFG
# готовность стенда через LB: /health/ready отвечает 200 от API_REPLICAS
# (из .env, по умолчанию 2) разных реплик — X-Instance-Id. Срок 60 с:
# make replicas ждёт healthy контейнеров, а слот LB включается ещё через
# rise проверок
wait_replicas() {
want=$(sed -n 's/^API_REPLICAS=//p' .env)
want=${want:-2}
seen=""
deadline=$(($(date +%s) + 60))
while [ "$(date +%s)" -lt "$deadline" ]; do
reply=$(curl -s -o /dev/null -w '%{http_code} %header{x-instance-id}' \
"$BASE_URL/health/ready" || true)
case "$reply" in
"200 "?*) seen=$(printf '%s\n%s\n' "$seen" "${reply#200 }" | sort -u | grep .) ;;
esac
if [ "$(printf '%s\n' "$seen" | grep -c .)" -ge "$want" ]; then
echo "LB ready: $(printf '%s ' $seen)"
return 0
fi
sleep 0.5
done
echo "LB: $(printf '%s\n' "$seen" | grep -c .) of $want replicas ready in 60 s" >&2
return 1
}