8622b6fc4e
CI Main / Load example-gitea-env.conf to pipeline env (push) Successful in 19s
CI Main / Check existing artifact (push) Successful in 14s
unit-tests Link to Bats reports
CI Main / Bats tests (push) Successful in 1m43s
acc-tests Link to Cucumber reports
CI Main / Cucumber tests (push) Successful in 1m9s
ci-docker-build-push Docker build & push 0.2.4 OK
CI Main / Build & Push Docker (push) Successful in 37s
CI Main / Report Summary (push) Successful in 5s
CI Main / Move provider version tag (push) Successful in 13s
Co-authored-by: moilanik <niko.moilanen@tietoevry.com> Reviewed-on: #15
127 lines
3.2 KiB
Markdown
127 lines
3.2 KiB
Markdown
# Reusable workflowt
|
|
|
|
> Provider-workflowt tarjoavat ydintoiminnallisuuden. Consumer kokoaa ne
|
|
> haluamakseen pipelineksi. Esimerkkitoteutus: `example-*`-tiedostot.
|
|
|
|
---
|
|
|
|
## Yhteiset konventiot
|
|
|
|
Kaikki workflowt:
|
|
- Käyttävät `concurrency:`-ryhmää estämään saman branchin rinnakkaiset ajot
|
|
- Provider-workflowt lukevat konfiguraation inputtina (`env_json`)
|
|
- Statusraportointi: tool-jobit natiivilla, test-jobit API:lla raporttilinkin takia (ADR 0007)
|
|
- Exit-koodi aina ylös, ei pipeä (ADR 0008)
|
|
|
|
---
|
|
|
|
## Provider-workflowt
|
|
|
|
### `config-provider.yml` — Konfiguraation lataus ja validointi
|
|
|
|
**Trigger:** `workflow_call`
|
|
|
|
**Inputs:**
|
|
|
|
| Parametri | Pakollinen | Kuvaus |
|
|
|-----------|------------|--------|
|
|
| `config_path` | Kyllä | Polku `.conf`-tiedostoon |
|
|
|
|
**Secrets:**
|
|
|
|
| Secret | Pakollinen | Kuvaus |
|
|
|--------|------------|--------|
|
|
| `GITEA_TOKEN` | Kyllä | Validointia varten |
|
|
| `GIT_PAGES_PUBLISH_TOKEN` | Kyllä | Validointia varten |
|
|
|
|
**Outputs:**
|
|
|
|
| Output | Kuvaus |
|
|
|--------|--------|
|
|
| `env_json` | JSON-muotoiset ympäristömuuttujat |
|
|
| `config_path` | Sama polku takaisin (DRY downstream-käyttöön) |
|
|
|
|
**Steppi-kaavio:**
|
|
```
|
|
checkout → validate CI config → parse conf to JSON
|
|
```
|
|
|
|
### `check-version.yml` — Version ja artifactin tarkistus
|
|
|
|
**Trigger:** `workflow_call` — käytetään vain main-haarassa
|
|
|
|
**Inputs:** `env_json`
|
|
|
|
**Outputs:** `artifact_exists` (true/false), `version` (string)
|
|
|
|
**Steppi-kaavio:**
|
|
```
|
|
checkout → laske versio package.json + git-tageista → output
|
|
```
|
|
|
|
### `docker-build-push.yml` — Docker build & push
|
|
|
|
**Trigger:** `workflow_call`
|
|
|
|
**Inputs:** `env_json`, `version`
|
|
|
|
**Secrets:** `GITEA_TOKEN`, `DOCKER_USERNAME`, `DOCKER_PASSWORD`
|
|
|
|
**Steppi-kaavio:**
|
|
```
|
|
build-push (build + push samassa jobissa, ei levyn kautta) → tag-commit
|
|
```
|
|
|
|
---
|
|
|
|
## Consumer-esimerkki (`example-*`)
|
|
|
|
### `example-feature.yml` — Feature-haaran CI
|
|
|
|
**Trigger:** `push` [branches-ignore: main]
|
|
|
|
```
|
|
load-config → bats + cucumber → report-summary (always)
|
|
```
|
|
|
|
### `example-main.yml` — Main-haaran CI
|
|
|
|
**Trigger:** `push` [branches: main]
|
|
|
|
```
|
|
load-config → check-version →
|
|
[artifact exists] → done
|
|
[no artifact] → bats + cucumber → report-summary (always) → docker-build-push
|
|
```
|
|
|
|
### `example-bats-tests.yml` — Bats unit-testit
|
|
|
|
**Trigger:** `workflow_call`
|
|
|
|
Ajaa Bats-testit Docker-kontissa, generoi coveragen (`bashcov`), julkaisee
|
|
raportit git-pagesiin, asettaa commit-statuksen linkillä raporttiin.
|
|
|
|
### `example-cucumber-tests.yml` — Cucumber hyväksymätestit
|
|
|
|
**Trigger:** `workflow_call`
|
|
|
|
Ajaa Cucumber-testit Node-kontissa, julkaisee raportit git-pagesiin, asettaa
|
|
commit-statuksen linkillä raporttiin.
|
|
|
|
### `report-summary.yml` — Raporttien koontinäkymä
|
|
|
|
**Trigger:** `workflow_call` — ajetaan `if: always()` testien jälkeen
|
|
|
|
**Inputs:** `env_json`, `suites` (space-separated lista suite-nimistä)
|
|
|
|
Generoi Markdown-taulukon `GITHUB_STEP_SUMMARY`:yn kaikista julkaistuista
|
|
raporteista. Renderöityy HTML:ksi Gitea 1.27+ Summary-välilehdellä.
|
|
Forward-compatibeli — ei haittaa vanhemmilla Gitea-versioilla.
|
|
|
|
---
|
|
|
|
## Suunnitteilla
|
|
|
|
- `deploy.yml` — GitOps-deployment (dispatch-workflow.sh-pohjainen)
|
|
- `test.yml` — Klusteritason test flow
|