docs: POC-katselmus — git-pages retention, ADRt, dokumenttipäivitykset
- ADR 0004: commit-status-periaate (natiivi riittää, API vain custom-linkkiin)
- ADR 0005: provider & consumer -malli (ci-engine.yml lukittu rajapinta)
- docs/design-rationale: uusi periaate 1 "Hyödynnä natiivia",
periaate 2 korjattu (API vain tarvittaessa),
periaate 6 (MinIO→git-pages), teknologiavalinnat poistettu
- docs/config-model: isContainerBuild→isArtifactBuild, Docker-labelit poistettu
- docs/ai-context: monorepo-kuvaus (git-pages oma kokonaisuus, ohut rajapinta)
- docs/architecture, tech-stack, report-hosting, shared-scripts, workflows:
MinIO→git-pages, provider agnostinen build-ekosysteemeille
- docs/adr/: ADRt siirretty decisions/→adr/
- git-pages/docs: retention-osiot päivitetty CronJob→sidecar+HTTP API,
URL-kaava korjattu (reports/{sha8}/)
- git-pages/docs/implementation-notes: uusi (storage v2, Host-header,
whiteout, .init, PATCH+directoryt)
- git-pages/templates/init-job.yaml: post-install init (.index)
- scripts/publish-git-pages.sh: PUT-fallback poistettu (init hoitaa),
palauttaa BASE URL ilman index.html
This commit is contained in:
@@ -23,42 +23,39 @@ TLS-rajaukset ovat Kubernetes-kerroksessa (Traefik, cert-manager, Secretit).
|
||||
| Komponentti | Rooli |
|
||||
|-------------|-------|
|
||||
| **git-pages Pod** | Codeberg git-pages `0.9.1`, filesystem-storage `/app/data` |
|
||||
| **PVC** | Raporttisisältö (`{owner}/{repo}/reports/{sha8}/…`) |
|
||||
| **retention sidecar** | Samassa podissa, HTTP API localhost:3000, siivoaa vanhat raportit |
|
||||
| **PVC** | Raporttisisältö (storage v2 — `.index` + blob) |
|
||||
| **Service** | ClusterIP :3000 git-pagesille |
|
||||
| **Traefik IngressRoute** | Julkaisu (PATCH/PUT + BasicAuth) ja luku (GET/HEAD) eri säännöillä |
|
||||
| **Traefik Middleware** | `git-pages-publish-auth` (BasicAuth), HTTPS-redirect |
|
||||
| **cert-manager Certificate** | TLS → Secret `git-pages-tls` |
|
||||
| **CronJob `git-pages-retention`** | Päivittäinen siivous (PVC + Gitea branch-lista) |
|
||||
|
||||
| Secret | Rooli |
|
||||
|--------|-------|
|
||||
| `git-pages-publish-auth` | htpasswd julkaisuun (Traefik) |
|
||||
| `git-pages-retention-gitea` | Gitea PAT branch-listaan (CronJob) |
|
||||
| `git-pages-publish-token` | plaintext token (Gitea Actions -secretiin vietäväksi) |
|
||||
| `git-pages-retention-gitea` | Gitea PAT branch-tarkistukseen (sidecar)
|
||||
|
||||
---
|
||||
|
||||
## URL ja sisältö
|
||||
|
||||
Julkinen osoite peilaa suoraan Gitean commit-polun rakennetta, lisäten raportin nimen:
|
||||
Julkinen osoite:
|
||||
|
||||
```
|
||||
https://ci-reports.helm-dev.keskikuja.site/niko/gitea-ci-library/commit/14cf2eaeed8a4033bc37c52b0b4c29f25b253ceb/cucumber/index.html
|
||||
└────────────── selvä URL ──────────────┘ └──────────────────────── Gitea-yhteensopiva polku ────────────────────────┘
|
||||
https://ci-reports.helm-dev.keskikuja.site/niko/gitea-ci-library/reports/f4baa286/cucumber/index.html
|
||||
└────────── selvä URL ─────────┘ └───────────────── Gitea-yhteensopiva polku ─────────────────────────┘
|
||||
```
|
||||
|
||||
Levyllä (apex index-site) polku vastaa URL:ia:
|
||||
Levyllä (apex index-site):
|
||||
|
||||
```
|
||||
/app/data/
|
||||
{owner}/
|
||||
{repo}/
|
||||
commit/
|
||||
{sha}/
|
||||
{raportin-nimi}/
|
||||
index.html
|
||||
.meta # branch, sha, published_at
|
||||
/app/data/site/{host}/
|
||||
.index # Protobuf-manifesti (storage v2 — kaikki tiedostot tässä yhdessä tiedostossa)
|
||||
```
|
||||
|
||||
Tiedostot eivät ole flat-FS:nä — katso `implementation-notes.md`.
|
||||
|
||||
Apex-juuri `/` on tyhjä — ei landing-sivua.
|
||||
|
||||
---
|
||||
@@ -78,10 +75,10 @@ flowchart TB
|
||||
CM["cert-manager\nTLS"]
|
||||
end
|
||||
|
||||
subgraph cluster["git-pages"]
|
||||
GP["git-pages Pod"]
|
||||
subgraph cluster["git-pages Pod"]
|
||||
GP["git-pages\n(kontti)"]
|
||||
RT["retention sidecar\n(kontti)\nHTTP API localhost:3000"]
|
||||
PVC["PVC /app/data"]
|
||||
CJ["CronJob retention"]
|
||||
end
|
||||
|
||||
PUB -->|"PATCH/PUT + BasicAuth\ntar"| TRAEFIK
|
||||
@@ -89,8 +86,8 @@ flowchart TB
|
||||
TRAEFIK --> GP
|
||||
CM --> TRAEFIK
|
||||
GP --> PVC
|
||||
CJ -->|"read branches"| GITEA
|
||||
CJ --> PVC
|
||||
RT -->|"reads .git-pages/manifest.json\nHTTP localhost"| GP
|
||||
RT -->|"check branches"| GITEA
|
||||
```
|
||||
|
||||
---
|
||||
@@ -119,15 +116,15 @@ Katso [design-rationale.md — Luku-auth](design-rationale.md#luku-auth).
|
||||
|
||||
## Retention
|
||||
|
||||
CronJob `git-pages-retention` (oletus kerran päivässä):
|
||||
Sidecar-kontti samassa podissa, ajaa retention-cleanup.sh 24h välein:
|
||||
|
||||
1. Skaalaa git-pages deployment hetkeksi pois (RWO-PVC)
|
||||
2. Käy läpi `reports/{sha8}/.meta`
|
||||
3. **Poistettu branch** — jos `.meta.branch` ei ole Gitean branch-listassa → poista (aina)
|
||||
4. **Aktiivinen branch** — `maxAgeDays` + `keepMin` (`retention.rules` instanssiarvoissa)
|
||||
5. Skaalaa deployment takaisin
|
||||
1. Lukee `.git-pages/manifest.json` HTTP:lla localhost:3000
|
||||
2. Etsii `.meta`-tiedostot, tarkistaa iän ja branchin
|
||||
3. **Poistettu branch** — jos `.meta.branch` ei ole Giteassa → whiteout PATCH
|
||||
4. **Aktiivinen branch** — `maxAgeDays` + `keepMin` (`retention.rules`)
|
||||
5. Whiteout-tar → PATCH localhost:3000 — poistaa raportit
|
||||
|
||||
Gitea API: `GET /api/v1/repos/{owner}/{repo}/branches` — `read:repository` PAT.
|
||||
Gitea API: `GET /api/v1/repos/{owner}/{repo}/branches/{branch}` — `read:repository` PAT.
|
||||
Katso [secrets.md](secrets.md).
|
||||
|
||||
---
|
||||
@@ -138,7 +135,8 @@ Katso [secrets.md](secrets.md).
|
||||
|--------|------------|------|--------|
|
||||
| Julkaisija → Traefik | HTTPS PATCH/PUT | BasicAuth `publish` | tar → apex site |
|
||||
| Selain → Traefik | HTTPS GET/HEAD | — (tänään) | HTML-raportti |
|
||||
| CronJob → Gitea | HTTPS GET | PAT `read:repository` | branch-lista per repo |
|
||||
| Sidecar → Gitea | HTTPS GET | PAT `read:repository` | branch-tarkistus per repo |
|
||||
| Sidecar → git-pages | HTTP :3000 | — (PAGES_INSECURE) | manifestin luku + whiteout PATCH |
|
||||
| Traefik → git-pages | HTTP :3000 | — | sisäverkko |
|
||||
|
||||
git-pages ei käytä Gitea forge-API:a julkaisuun eikä `pages`-branchia.
|
||||
|
||||
Reference in New Issue
Block a user