tiketit ja featuret vaihe 1
This commit is contained in:
@@ -0,0 +1,112 @@
|
||||
# Ticket 0007: `deploy.yml` (reusable workflow)
|
||||
|
||||
**Vaihe:** 7/12
|
||||
**Status:** pending
|
||||
**Feature branch:** `feature/0007-deploy-yml`
|
||||
**TDD required:** Yes
|
||||
**Feature file required:** Yes
|
||||
|
||||
**Required context:**
|
||||
- `docs/test-plan/tdd-guide.md`
|
||||
- `tests/features/0007-deploy.feature`
|
||||
- Skills: `tdd`, `implementation`, `clean-code`
|
||||
|
||||
---
|
||||
|
||||
## TDD — Red-Green-Refactor + Dogfood
|
||||
|
||||
### Red
|
||||
Validointitesti (`tests/workflows.bats`):
|
||||
- `workflow_dispatch`-inputit määritelty: `environment`, `version`, `root_commit`, `root_repo`, `root_build_url`
|
||||
- YAML-päivityksen testi: `yq` muuttaa `container.version`-arvon
|
||||
- Cross-repo-statusraportoinnin testi
|
||||
|
||||
```bash
|
||||
bats tests/workflows.bats
|
||||
# FAIL
|
||||
```
|
||||
|
||||
### Green
|
||||
Toteuta `gitea/workflows/deploy.yml`.
|
||||
|
||||
```bash
|
||||
bats tests/workflows.bats
|
||||
# PASS
|
||||
```
|
||||
|
||||
### Dogfood
|
||||
Lisää kutsu `gitea/workflows/ci.yml`:stä (käytetään master-flow'n test flow -ketjussa).
|
||||
|
||||
## DoD
|
||||
- [ ] Cucumber: `@ticket-0007 and @mock` → kaikki skenaariot GREEN
|
||||
- [ ] `tests/workflows.bats` — workflow-validointi läpi
|
||||
- [ ] YAML-arvo päivittyy `yq`:lla: `container.version: <new_value>`
|
||||
- [ ] `git commit` + `git push` Helm-repoon
|
||||
- [ ] Cross-repo-status: Helm-commit + root-commit molemmat raportoitu
|
||||
- [ ] Dogfood: oma CI voi dispatchata tämän
|
||||
|
||||
---
|
||||
|
||||
## Toiminto
|
||||
|
||||
GitOps-deployment: lukee Helm-values-YAML:n, päivittää `container.version`-arvon, committaa ja pushaa. Raportoi cross-repo-statuksen.
|
||||
|
||||
## Trigger
|
||||
|
||||
`workflow_dispatch` (aina dispatchataan toisesta workflow'sta)
|
||||
|
||||
## Inputs (dispatch-parametrit)
|
||||
|
||||
| Parametri | Kuvaus |
|
||||
|-----------|--------|
|
||||
| `environment` | Ympäristön nimi (korvaa `{.environment}`) |
|
||||
| `version` | Uusi konttiversio |
|
||||
| `root_commit` | Mikropalvelun commit josta deploy käynnistyi |
|
||||
| `root_repo` | Mikropalvelun repo |
|
||||
| `root_build_url` | URL mikropalvelun buildiin |
|
||||
|
||||
## Steppit
|
||||
|
||||
```
|
||||
start → read-yaml → update-value → commit → push → report-cross-repo → end
|
||||
```
|
||||
|
||||
| Steppi | Toiminto |
|
||||
|--------|----------|
|
||||
| `read-yaml` | Lue `{projectFolder}/{fileName}` (korvaa `{.environment}`) |
|
||||
| `update-value` | `yq` tai vastaava: aseta `{property}` = `{version}` |
|
||||
| `commit` | `git add` + `git commit -m "deploy {version} to {environment}"` |
|
||||
| `push` | `git push origin HEAD:master` |
|
||||
| `report-cross-repo` | `report-status.sh` — raportoi molempiin suuntiin |
|
||||
|
||||
## Cross-repo-raportointi
|
||||
|
||||
```bash
|
||||
# Helm-repon committiin: mistä deploy tuli
|
||||
report-status.sh success "from {root_commit}" "{root_build_url}" "from" "$GITHUB_SHA" "$GITHUB_REPOSITORY"
|
||||
|
||||
# Mikropalvelun committiin: deployattu
|
||||
report-status.sh success "deployed to {environment}" "{helm_commit_url}" "deploy-{environment}" "$ROOT_COMMIT" "$ROOT_REPO"
|
||||
```
|
||||
|
||||
## Concurrency
|
||||
|
||||
```yaml
|
||||
concurrency:
|
||||
group: deploy-${{ github.repository }}-${{ inputs.environment }}
|
||||
cancel-in-progress: false
|
||||
```
|
||||
|
||||
## Verifiointi
|
||||
|
||||
Dispatchaa mock-inputeilla:
|
||||
1. YAML-arvo päivittyy oikein (esim. `container.version: 1.2.3.42` → `1.2.3.43`)
|
||||
2. Commit ja push onnistuvat
|
||||
3. Statusviesti ilmestyy Helm-repon commitille: "from abc123"
|
||||
4. Statusviesti ilmestyy mikropalvelun commitille: "deployed to staging"
|
||||
|
||||
## Viitteet
|
||||
|
||||
- `docs/workflows.md` — `deploy.yml` — GitOps-deployment
|
||||
- `docs/architecture.md` — Tietovuo 2: Cross-repo traceability
|
||||
- `docs/config-model.md` — Deployment-konfiguraatio
|
||||
Reference in New Issue
Block a user