Rename PI_TEST_* secrets to PI_MAIN_* and centralize adjustable workflow values

Co-authored-by: Junie <junie@jetbrains.com>
This commit is contained in:
2026-07-24 16:18:46 +02:00
co-authored by Junie
parent fd31f02091
commit 3e537162c0
5 changed files with 68 additions and 22 deletions
+20 -6
View File
@@ -6,6 +6,16 @@ on:
push: push:
branches: [master] branches: [master]
# Herbruikbare instellingen voor deze workflow. Pas deze aan op één plek als
# de Node/pnpm-versie wijzigt. Let op: de env-context is NIET beschikbaar in
# de `with:`-inputs van een aangeroepen reusable workflow (zie de deploy-test
# job hieronder), dat is een beperking van GitHub/Gitea Actions zelf, dus
# ARTIFACT_NAME/DEPLOY_ENVIRONMENT/DEPLOY_PATH blijven daar noodgedwongen
# letterlijk in de `with:`-sectie staan.
env:
NODE_VERSION: '20'
PNPM_VERSION: '9'
jobs: jobs:
prepare: prepare:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -14,11 +24,11 @@ jobs:
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
with: with:
node-version: '20' node-version: ${{ env.NODE_VERSION }}
- uses: pnpm/action-setup@v4 - uses: pnpm/action-setup@v4
with: with:
version: 9 version: ${{ env.PNPM_VERSION }}
- name: Get pnpm store directory - name: Get pnpm store directory
id: pnpm-store id: pnpm-store
@@ -41,11 +51,11 @@ jobs:
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
with: with:
node-version: '20' node-version: ${{ env.NODE_VERSION }}
- uses: pnpm/action-setup@v4 - uses: pnpm/action-setup@v4
with: with:
version: 9 version: ${{ env.PNPM_VERSION }}
- name: Get pnpm store directory - name: Get pnpm store directory
id: pnpm-store id: pnpm-store
@@ -78,11 +88,11 @@ jobs:
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
with: with:
node-version: '20' node-version: ${{ env.NODE_VERSION }}
- uses: pnpm/action-setup@v4 - uses: pnpm/action-setup@v4
with: with:
version: 9 version: ${{ env.PNPM_VERSION }}
- name: Get pnpm store directory - name: Get pnpm store directory
id: pnpm-store id: pnpm-store
@@ -108,6 +118,10 @@ jobs:
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref == 'refs/heads/master') if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref == 'refs/heads/master')
uses: ./.gitea/workflows/deploy.yaml uses: ./.gitea/workflows/deploy.yaml
secrets: inherit secrets: inherit
# Let op: deze waarden kunnen hier NIET via het `env:`-blok bovenaan dit
# bestand worden gezet - de env-context is niet beschikbaar in de
# `with:`-sectie van een aangeroepen reusable workflow (beperking van
# GitHub/Gitea Actions zelf). Pas deze waarden dus rechtstreeks hier aan.
with: with:
artifact_name: dist artifact_name: dist
environment: test environment: test
+4 -4
View File
@@ -31,10 +31,10 @@ jobs:
- name: Upload dist to ${{ inputs.environment }} web server via SCP - name: Upload dist to ${{ inputs.environment }} web server via SCP
uses: appleboy/scp-action@v0.1.7 uses: appleboy/scp-action@v0.1.7
with: with:
host: ${{ secrets.PI_TEST_HOST }} host: ${{ secrets.PI_MAIN_HOST }}
port: ${{ secrets.PI_TEST_PORT }} port: ${{ secrets.PI_MAIN_PORT }}
username: ${{ secrets.PI_TEST_USERNAME }} username: ${{ secrets.PI_MAIN_USERNAME }}
password: ${{ secrets.PI_TEST_PASSWORD }} password: ${{ secrets.PI_MAIN_PASSWORD }}
source: "dist/*" source: "dist/*"
target: ${{ inputs.deploy_path }} target: ${{ inputs.deploy_path }}
strip_components: 1 strip_components: 1
+25 -1
View File
@@ -369,6 +369,30 @@
**AI Response**: "Corrected the assumed internal port for the webserver Pi: updated `nginx/webserver-nginx.conf.example` (`listen 192.168.1.103:80` / `listen [::]:80`) and `nginx/reverse-proxy-nginx.conf.example` (`proxy_pass http://192.168.1.103:80`), replacing the previously assumed port `8080`. No other files referenced this port." **AI Response**: "Corrected the assumed internal port for the webserver Pi: updated `nginx/webserver-nginx.conf.example` (`listen 192.168.1.103:80` / `listen [::]:80`) and `nginx/reverse-proxy-nginx.conf.example` (`proxy_pass http://192.168.1.103:80`), replacing the previously assumed port `8080`. No other files referenced this port."
**Context**: Post-workflow follow-up (feature already marked Complete); corrects an incorrect assumption from the earlier test-environment deploy follow-up. Changes not yet committed/pushed. **Context**: Post-workflow follow-up (feature already marked Complete); corrects an incorrect assumption from the earlier test-environment deploy follow-up. Changes committed on `feature/updates_gitea_workflow` (commit `fd31f02`).
---
## Post-Completion Follow-up: Secrets Renamed from PI_TEST_* to PI_MAIN_*
**Timestamp**: 2026-07-24T16:07:00Z
**User Input**: "De secrets mag je PI_MAIN_* noemen. PI_TEST is iets te specifiek want alle webhosts krijgen dezelfde gegevens. In ieder geval voor nu. Mocht dat veranderen dan komt dat later wel" (followed by "Ik zie dat je de secret namen niet hebt veranderd. Ze mogen worden aangepast van PI_TEST_HOST naar PI_MAIN_HOST enzovoorts").
**AI Response**: "Renamed all `PI_TEST_HOST`/`PI_TEST_PORT`/`PI_TEST_USERNAME`/`PI_TEST_PASSWORD` secret references to `PI_MAIN_HOST`/`PI_MAIN_PORT`/`PI_MAIN_USERNAME`/`PI_MAIN_PASSWORD` in `.gitea/workflows/deploy.yaml`, `deployment-plan.md`, and `deployment-instructions.md` (including the SSH-key future-work note, now `PI_MAIN_SSH_KEY`). Added an explanatory note that the name is intentionally host-based rather than environment-specific, since all webhosts currently share the same Pi and credentials; environment-specific secrets can be introduced later if that changes."
**Context**: Post-workflow follow-up (feature already marked Complete); addresses user feedback that the secret naming should reflect the shared webhost rather than being test-specific. Changes committed together with the follow-up below.
---
## Post-Completion Follow-up: Adjustable Values Extracted to Workflow Variables
**Timestamp**: 2026-07-24T16:16:00Z
**User Input**: "Kan het pad en eventuele andere aanpasbare waarden bovenin de workflow als variabele worden toegevoegd? Dat maakt het makkelijker en duidelijker welke waarden eventueel anders kunnen worden. Als dat niet kan met Gitea workflows laat het dan maar zitten en commit dan meteen alle changes"
**AI Response**: "Added a top-level `env:` block (`NODE_VERSION`, `PNPM_VERSION`) to `continuous_integration.yaml`, referenced from all `setup-node`/`pnpm/action-setup` steps across the `prepare`/`build`/`test` jobs. Investigated whether `deploy_path`/`environment`/`artifact_name` (the `deploy-test` job's reusable-workflow call) could be moved to the same `env:` block: this is **not possible** — GitHub/Gitea Actions does not expose the `env` context inside `jobs.<job_id>.with` when calling a reusable workflow (only within `jobs.<job_id>.steps`), so those values must stay as literal inputs in that job. Documented this limitation clearly in `deployment-instructions.md`. Committed all outstanding changes (this follow-up plus the previous `PI_MAIN_*` rename) on `feature/updates_gitea_workflow`."
**Context**: Post-workflow follow-up (feature already marked Complete); addresses user request to centralize adjustable workflow values, with an explicit Gitea/GitHub Actions limitation documented for the parts that could not be centralized.
--- ---
@@ -9,19 +9,25 @@ Sinds deze stap wordt er automatisch gedeployed naar een **testomgeving**: een R
## Pipeline Files ## Pipeline Files
- `continuous_integration.yaml` — getriggerd door `pull_request` (build/test/lint-gate), `push` naar `master`, en handmatig via `workflow_dispatch`. - `continuous_integration.yaml` — getriggerd door `pull_request` (build/test/lint-gate), `push` naar `master`, en handmatig via `workflow_dispatch`.
- Heeft bovenaan een `env:`-blok (`NODE_VERSION`, `PNPM_VERSION`) — pas de Node/pnpm-versie hier op één plek aan, gebruikt wordt dit door alle `setup-node`/`pnpm/action-setup`-stappen.
- `prepare``build` (uploadt `dist` artifact) → `test` (lint + unit tests) - `prepare``build` (uploadt `dist` artifact) → `test` (lint + unit tests)
- `deploy-test` (alleen bij `workflow_dispatch` of een push naar `master`) roept `deploy.yaml` aan met `environment: test` en `deploy_path: /html/test/slpsoftware` - `deploy-test` (alleen bij `workflow_dispatch` of een push naar `master`) roept `deploy.yaml` aan met `environment: test` en `deploy_path: /html/test/slpsoftware`
- `deploy.yaml` — download de `dist`-artifact en upload de inhoud via `appleboy/scp-action` naar de opgegeven `deploy_path` op de host uit de meegegeven secrets. - `deploy.yaml` — download de `dist`-artifact en upload de inhoud via `appleboy/scp-action` naar de opgegeven `deploy_path` op de host uit de meegegeven secrets. `deploy_path`/`environment`/`artifact_name` zijn al herbruikbare inputs bovenaan dit bestand (`workflow_call.inputs`).
### Waarom staan `deploy_path`/`environment` niet ook in het `env:`-blok?
Gitea/GitHub Actions ondersteunt geen `env`-context in de `with:`-sectie waarmee een reusable workflow wordt aangeroepen (`jobs.<job_id>.with`) — dat werkt alléén binnen `jobs.<job_id>.steps`. Daarom moeten `artifact_name`, `environment` en `deploy_path` in de `deploy-test`-job in `continuous_integration.yaml` letterlijk blijven staan; dit is een beperking van Actions zelf, niet iets dat hier is opgelost. Wil je dit pad wijzigen, pas dan die regels rechtstreeks aan (zie ook de eerdere uitleg hierover).
## Eenmalige Setup — Gitea Secrets ## Eenmalige Setup — Gitea Secrets
Voeg deze secrets toe in Gitea: **Repository → Settings → Actions → Secrets**: Voeg deze secrets toe in Gitea: **Repository → Settings → Actions → Secrets**:
| Secret | Waarde | | Secret | Waarde |
|---|---| |---|---|
| `PI_TEST_HOST` | Intern IP-adres van de webserver-Pi (`192.168.1.103`) | | `PI_MAIN_HOST` | Intern IP-adres van de webserver-Pi (`192.168.1.103`) |
| `PI_TEST_PORT` | SSH-poort (`2224`) | | `PI_MAIN_PORT` | SSH-poort (`2224`) |
| `PI_TEST_USERNAME` | SSH-gebruikersnaam (`webadmin`) | | `PI_MAIN_USERNAME` | SSH-gebruikersnaam (`webadmin`) |
| `PI_TEST_PASSWORD` | Het SSH-wachtwoord van deze gebruiker | | `PI_MAIN_PASSWORD` | Het SSH-wachtwoord van deze gebruiker |
Deze secrets heten `PI_MAIN_*` (niet `PI_TEST_*`), omdat dezelfde Pi (Pi Main) en dezelfde inloggegevens naar verwachting ook voor toekomstige omgevingen/webhosts gebruikt worden. Mocht dat later veranderen, dan worden hiervoor alsnog omgeving-specifieke secrets geïntroduceerd.
## Eenmalige Setup — Domeinnaam & DNS ## Eenmalige Setup — Domeinnaam & DNS
- **Test**: `test.slpsoftware.nl` → moet als DNS A-record wijzen naar het publieke IP van de reverse-proxy-Pi. - **Test**: `test.slpsoftware.nl` → moet als DNS A-record wijzen naar het publieke IP van de reverse-proxy-Pi.
@@ -48,5 +54,5 @@ Merge een pull request naar `master` — de `deploy-test` job draait dan automat
2. Open de testomgeving in de browser (via het adres/IP dat je bij de reverse-proxy hebt ingesteld) en controleer dat de site correct laadt (check de browserconsole op fouten, zoals in de handmatige smoke test in `construction/build-and-test/integration-test-instructions.md`). 2. Open de testomgeving in de browser (via het adres/IP dat je bij de reverse-proxy hebt ingesteld) en controleer dat de site correct laadt (check de browserconsole op fouten, zoals in de handmatige smoke test in `construction/build-and-test/integration-test-instructions.md`).
## Future Work ## Future Work
- **Van wachtwoord naar SSH-key**: vervang `password: ${{ secrets.PI_TEST_PASSWORD }}` in `deploy.yaml` door `key: ${{ secrets.PI_TEST_SSH_KEY }}` (een nieuwe secret met de private key-inhoud), en zet de bijbehorende public key in `~/.ssh/authorized_keys` van de `webadmin`-gebruiker op de webserver-Pi. Verwijder daarna het wachtwoord-secret. - **Van wachtwoord naar SSH-key**: vervang `password: ${{ secrets.PI_MAIN_PASSWORD }}` in `deploy.yaml` door `key: ${{ secrets.PI_MAIN_SSH_KEY }}` (een nieuwe secret met de private key-inhoud), en zet de bijbehorende public key in `~/.ssh/authorized_keys` van de `webadmin`-gebruiker op de webserver-Pi. Verwijder daarna het wachtwoord-secret.
- **Productie-omgeving**: voeg een `deploy-production`-job toe zodra de definitieve productiehosting bekend is (zie `deployment-plan.md`'s "Open Item"), en pas `nginx/reverse-proxy-nginx-production.conf.example` (domein `slpsoftware.nl`) toe zodra de webserver-locatie voor productie vastligt. - **Productie-omgeving**: voeg een `deploy-production`-job toe zodra de definitieve productiehosting bekend is (zie `deployment-plan.md`'s "Open Item"), en pas `nginx/reverse-proxy-nginx-production.conf.example` (domein `slpsoftware.nl`) toe zodra de webserver-locatie voor productie vastligt.
@@ -27,15 +27,17 @@ Zie `rollback-plan.md` — voor de testomgeving kan een eerdere commit/branch op
## Secrets & Configuration ## Secrets & Configuration
Voor de testomgeving zijn de volgende Gitea Actions Secrets (repository-niveau) vereist: Voor de testomgeving zijn de volgende Gitea Actions Secrets (repository-niveau) vereist:
- `PI_TEST_HOST``192.168.1.103` (intern IP van de webserver-Pi) - `PI_MAIN_HOST``192.168.1.103` (intern IP van de webserver-Pi)
- `PI_TEST_PORT``2224` - `PI_MAIN_PORT``2224`
- `PI_TEST_USERNAME``webadmin` - `PI_MAIN_USERNAME``webadmin`
- `PI_TEST_PASSWORD` — het SSH-wachtwoord van deze gebruiker - `PI_MAIN_PASSWORD` — het SSH-wachtwoord van deze gebruiker
Deze secrets heten bewust `PI_MAIN_*` in plaats van `PI_TEST_*`: alle webhosts gebruiken op dit moment dezelfde inloggegevens (dezelfde Pi), dus de naam is niet omgeving-specifiek. Mocht dat in de toekomst veranderen, dan worden alsnog omgeving-specifieke secrets geïntroduceerd.
Dit is bewust wachtwoord-authenticatie (voor nu, zoals gekozen), zodat de testomgeving snel werkend is. Zie "Future Work" in `deployment-instructions.md` voor de overstap naar SSH-key-authenticatie. Dit is bewust wachtwoord-authenticatie (voor nu, zoals gekozen), zodat de testomgeving snel werkend is. Zie "Future Work" in `deployment-instructions.md` voor de overstap naar SSH-key-authenticatie.
## Open Item — Productie-deploy Nog Niet Geautomatiseerd ## Open Item — Productie-deploy Nog Niet Geautomatiseerd
Zodra de definitieve productiehosting bekend is (en of dit dezelfde soort Raspberry Pi-opstelling is, of een externe hostingpartij), voeg een `deploy-production`-job toe aan `continuous_integration.yaml` die `deploy.yaml` aanroept met `environment: production`, en configureer de bijbehorende secrets (`PI_PROD_*` of vergelijkbaar). Domeinnaam (`slpsoftware.nl`) en SSL-aanpak (certbot/Let's Encrypt op de reverse-proxy-Pi) liggen al vast, zie `nginx/reverse-proxy-nginx-production.conf.example`. Zodra de definitieve productiehosting bekend is (en of dit dezelfde soort Raspberry Pi-opstelling is, of een externe hostingpartij), voeg een `deploy-production`-job toe aan `continuous_integration.yaml` die `deploy.yaml` aanroept met `environment: production`. Zolang het dezelfde webhost (Pi Main) blijft, kunnen de bestaande `PI_MAIN_*` secrets hergebruikt worden; pas dit pas aan naar omgeving-specifieke secrets als productie daadwerkelijk op een andere host komt. Domeinnaam (`slpsoftware.nl`) en SSL-aanpak (certbot/Let's Encrypt op de reverse-proxy-Pi) liggen al vast, zie `nginx/reverse-proxy-nginx-production.conf.example`.
## Verified Build Prerequisite ## Verified Build Prerequisite
Dit plan bouwt voort op de Build and Test-stage (`construction/build-and-test/build-and-test-summary.md`): `pnpm run build` produceert een statische `dist/`-bundel zonder server-side vereisten, geschikt om direct door nginx geserveerd te worden. Dit plan bouwt voort op de Build and Test-stage (`construction/build-and-test/build-and-test-summary.md`): `pnpm run build` produceert een statische `dist/`-bundel zonder server-side vereisten, geschikt om direct door nginx geserveerd te worden.