Files
docs/infrastructure/test-contour/guides/gitea-ci.md
T

74 lines
3.0 KiB
Markdown
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.
# Gitea: теги, CI/CD и registry
В test-контуре каждый сервис (`backend`, `adminpanel`, `cabinet`, `docs`) — **отдельный репозиторий** в Gitea. Релиз = **git-тег** → Gitea Actions → Docker-образ → обновление `sova-deploy` → ArgoCD sync.
Подробнее о формате тегов: [Система тегов CI/CD](../tags).
## 1. Вход в Gitea
Откройте http://git.sova.local и войдите под `gitea_admin` (пароль — из bootstrap или `.generated/platform-credentials.env`).
![Страница входа Gitea](../screenshots/01-gitea-login.png)
## 2. Репозитории организации `sova`
Все сервисы и GitOps лежат в org **sova**:
| Репозиторий | Назначение |
|-------------|------------|
| `backend`, `adminpanel`, `cabinet`, `docs` | код + `.gitea/workflows/build.yml` |
| `sova-deploy` | Helm values, ArgoCD manifests |
| `sova-mocks` | WireMock, Mailpit |
![Организация sova](../screenshots/02-gitea-org-sova.png)
## 3. Gitea Actions — pipeline на push тега
Workflow в каждом app-репозитории:
1. **test** — unit/build проверки
2. **build-and-push** — образ в Container Registry
3. **deploy-gitops** — commit в `sova-deploy` (`values-test.yaml`)
![Список workflow runs](../screenshots/03-gitea-backend-actions.png)
Откройте последний успешный run — все три job должны быть зелёными:
![Детали pipeline](../screenshots/04-gitea-action-run.png)
::: tip Terminal на runner
Логи runner: `kubectl logs -n gitea -l app.kubernetes.io/name=actions-runner -c runner -f`
:::
## 4. Как выкатить тег (с Mac)
```bash
cd k3s-test
./scripts/release-test-tag.sh backend backend-v1.0.1-test
./scripts/release-test-tag.sh adminpanel adminpanel-v1.0.1-test
./scripts/release-test-tag.sh cabinet cabinet-v1.0.1-test
./scripts/release-test-tag.sh docs docs-v1.0.1-test
```
Скрипт создаёт аннотированный тег и пушит в Gitea. Тег виден в репозитории:
![Теги backend](../screenshots/05-gitea-backend-tags.png)
Формат: `{component}-v{semver}-{env}` → например `backend-v1.0.1-test`.
## 5. Container Registry
После успешного `build-and-push` образ появляется в **Packages** репозитория:
![Container packages](../screenshots/06-gitea-backend-packages.png)
В Helm `values-test.yaml` используется pull через `git.sova.local/sova/backend:backend-v1.0.1-test` (см. `./scripts/configure-k3s-registry.sh`).
## 6. Чеклист после релиза
1. http://git.sova.local/sova/backend/actions — все jobs **success**
2. http://argocd.sova.local — `backend-test` **Synced / Healthy**
3. `curl http://api.test.sova.local/news/list?page=1`**200**
Дальше: [ArgoCD — приложения и sync](./argocd).