feat(scripts): implement report-status.sh with bats and cucumber tests (#1)
Co-authored-by: moilanik <niko.moilanen@tietoevry.com> Reviewed-on: #1
This commit is contained in:
@@ -0,0 +1,94 @@
|
||||
# Gitea Actions CI -kirjasto
|
||||
|
||||
Reusable workflow -kirjasto Gitea Actionsille. Lisätietoja: [docs/](docs/)
|
||||
|
||||
## Main-haaran suojaus
|
||||
|
||||
Jokaisessa tätä kirjastoa käyttävässä repossa `main`-haara suojataan — koodi päätyy sinne vain PR:n kautta:
|
||||
|
||||
```
|
||||
Repository → Settings → Branches → Branch Protection → Add Rule
|
||||
```
|
||||
|
||||
| Osio | Asetus | Arvo |
|
||||
|------|--------|------|
|
||||
| **Patterns** | Protected Branch Name Pattern | `main` |
|
||||
| **Push** | Disable Push | ✓ |
|
||||
| **Force Push** | Disable Force Push | ✓ |
|
||||
| **Pull Request Approvals** | Required approvals | `1` |
|
||||
| | Dismiss stale approvals | ✓ |
|
||||
| | Ignore stale approvals | ✓ |
|
||||
| | Enable Status Check | ✓ (kun CI on olemassa) |
|
||||
| **Pull Request Merge** | Block merge on rejected reviews | ✓ |
|
||||
| | Block merge on official review requests | ✓ |
|
||||
| | Block merge if pull request is outdated | ✓
|
||||
|
||||
## Gitea Actions runner (K8s / Helm)
|
||||
|
||||
Act runner suorittaa Gitea Actions workflowt. Asennus Kubernetes-klusteriin Helm chartilla:
|
||||
|
||||
### 1. Rekisteröintitoken
|
||||
|
||||
Hae token Giteasta:
|
||||
- **Organization-taso:** Org → Settings → Actions → Runners → Create new runner
|
||||
- **Globaali (site admin):** Site Admin → Actions → Runners → Create new runner
|
||||
|
||||
### 2. Asenna runner
|
||||
|
||||
```bash
|
||||
GITEA_URL="https://<gitea-server-url>"
|
||||
GITEA_ACTIONS_TOKEN="<registration-token>"
|
||||
GITEA_ACTIONS_NAMESPACE="gitea-actions"
|
||||
|
||||
helm repo add gitea https://dl.gitea.com/charts
|
||||
helm repo update
|
||||
|
||||
kubectl create secret generic act-runner-token \
|
||||
--from-literal=token="$GITEA_ACTIONS_TOKEN" \
|
||||
--namespace "$GITEA_ACTIONS_NAMESPACE" \
|
||||
--dry-run=client -o yaml | kubectl apply -f -
|
||||
|
||||
helm upgrade --install act-runner gitea/actions \
|
||||
--set enabled=true \
|
||||
--set giteaRootURL="$GITEA_URL" \
|
||||
--set existingSecret=act-runner-token \
|
||||
--set existingSecretKey=token \
|
||||
--set-string 'statefulset.runner.config=log:
|
||||
level: info
|
||||
cache:
|
||||
enabled: false
|
||||
container:
|
||||
require_docker: true
|
||||
docker_timeout: 300s' \
|
||||
--namespace "$GITEA_ACTIONS_NAMESPACE" \
|
||||
--create-namespace
|
||||
```
|
||||
|
||||
Oletus-lokitaso on `debug` — suositeltu `info`. Näkee jobien aloitukset ja valmistumiset ilman konttikerrosten purkua (Downloading/Extracting-spämmiä). `debug` on tarpeen vain vianselvityksessä.
|
||||
|
||||
### 3. Varmista
|
||||
|
||||
```bash
|
||||
kubectl get pods -n gitea-actions
|
||||
# → act-runner-runner-0 2/2 Running
|
||||
```
|
||||
|
||||
Gitean puolella runner ilmestyy Active-tilaan pienellä viiveellä:
|
||||
|
||||
```
|
||||
Site Admin → Actions → Runners (tai Org → Settings → Actions → Runners)
|
||||
# → act-runner-runner-0 Active ubuntu-latest
|
||||
```
|
||||
|
||||
Tämän jälkeen `.gitea/workflows/ci.yml` triggeröityy automaattisesti pushista.
|
||||
|
||||
Lisätietoa runnerin toiminnasta, konteista ja DinD:stä: [docs/runner.md](docs/runner.md)
|
||||
|
||||
### Muuta
|
||||
|
||||
| Muuttuja | Kuvaus |
|
||||
|----------|--------|
|
||||
| `giteaRootURL` | Gitea-palvelimen osoite (esim. `https://gitea.example.com`) |
|
||||
| `existingSecret` | Kubernetes secretin nimi, jossa token |
|
||||
| `existingSecretKey` | Avain secretin sisällä |
|
||||
| `statefulset.runner.labels` | Mukautetut labelit |
|
||||
|
||||
Reference in New Issue
Block a user