3.0 KiB
3.0 KiB
Ticket 0003: push-reports.sh
Vaihe: 3/12
Status: pending
Feature branch: feature/0003-push-reports-sh
TDD required: Yes
Feature file required: Yes
Required context:
docs/test-plan/tdd-guide.mdtests/features/0003-push-reports.feature- Skills:
tdd,implementation,clean-code,bash-script
TDD — Red-Green-Refactor
Red
Kirjoita tests/push-reports.bats mock-MinIO:a vasten:
mc cp --recursivekopioi oikeaan polkuun- URL-tulostus:
{MINIO_BASE}/{repo}/{commit_short}/{report_type}/index.html - Raporttityypit:
cucumber,jacoco,junit,site index_title-parametri välittyy oikein- Lähdehakemistoa ei ole → exit 1
bats tests/push-reports.bats
# FAIL
Green
scripts/push-reports.sh — mc cp + URL-tulostus + indeksipäivitys (report-service/generate-index.sh).
bats tests/push-reports.bats
# PASS
Refactor
Poista duplikaatio, varmista mc-alias-konfigurointi.
DoD
- Cucumber:
@ticket-0003 and @mock→ kaikki skenaariot GREEN tests/push-reports.bats— kaikki testit läpi- Raportit kopioituvat oikeaan MinIO-polkuun
- URL-tulostus deterministinen
- Indeksisivut päivittyvät (
report-service/generate-index.sh)
Toiminto
Puskaa testiraporttihakemiston MinIO:hon ja päivittää indeksisivut. Palauttaa URL:n, joka syötetään report-status.sh:lle commit-statusviestin url-kenttään.
Rajapinta
push-reports.sh <report_type> <source_dir> [index_title]
| Parametri | Pakollinen | Kuvaus |
|---|---|---|
report_type |
Kyllä | cucumber, jacoco, junit, site |
source_dir |
Kyllä | Paikallinen hakemisto |
index_title |
Ei | Näkyvä nimi indeksisivulla |
Toiminta
mc cp --recursive {source_dir} minio/reports/{repo}/{commit_short}/{report_type}/- Päivitä
/reports/{repo}/{commit_short}/index.html— lisää linkki tähän raporttiin - Päivitä
/reports/{repo}/index.html— varmista että build on listalla - Tulosta URL:
{MINIO_BASE_URL}/{repo}/{commit_short}/{report_type}/index.html
URL-rakenne
{MINIO_BASE}/{repo_slug}/{commit_short}/{report_type}/index.html
Ympäristömuuttujat
MINIO_BASE_URL— Org variableMINIO_ACCESS_KEY— Org secret (alias:mc)MINIO_SECRET_KEY— Org secret (alias:mc)GITHUB_REPOSITORY— AutomaattinenGITHUB_SHA— Automaattinen (8 merkkiä)
Verifiointi
bash scripts/push-reports.sh cucumber target/cucumber-report "Cucumber Reports"
# → https://reports.example.com/temperature-store/abc12345/cucumber/overview-features.html
Tarkista:
- MinIO-bucketissa raportit oikeassa polussa
/reports/temperature-store/abc12345/index.htmlsisältää linkin/reports/temperature-store/index.htmlsisältää buildin
Viitteet
docs/shared-scripts.md— Rajapinnan määrittelydocs/report-hosting.md— MinIO-konfiguraatio ja URL-rakennedocs/design-rationale.md— Periaate 5: Raportit ovat selailtavia URL:n takana