CI: workflow_dispatch-inputs en config-uitvoer met sitenaam (deploy_sls_test, deploy_sls_production, *_sls_*, artefacten app-sls-*); docs bijgewerkt
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,12 +3,12 @@ name: Continuous Integration
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
deploy_test:
|
||||
description: 'Deploy to Test'
|
||||
deploy_sls_test:
|
||||
description: 'Deploy SLS test (SlpSoftware)'
|
||||
type: boolean
|
||||
default: false
|
||||
deploy_production:
|
||||
description: 'Deploy to Production'
|
||||
deploy_sls_production:
|
||||
description: 'Deploy SLS production (SlpSoftware)'
|
||||
type: boolean
|
||||
default: false
|
||||
deploy_asf_test:
|
||||
@@ -38,10 +38,10 @@ env:
|
||||
NODE_VERSION: '20'
|
||||
PNPM_VERSION: '9'
|
||||
PUBLISH_RID: linux-arm64
|
||||
ARTIFACT_NAME_TEST: app-test
|
||||
ARTIFACT_NAME_PRODUCTION: app-production
|
||||
DEPLOY_ENVIRONMENT_TEST: test
|
||||
DEPLOY_ENVIRONMENT_PRODUCTION: production
|
||||
ARTIFACT_NAME_SLS_TEST: app-sls-test
|
||||
ARTIFACT_NAME_SLS_PRODUCTION: app-sls-production
|
||||
DEPLOY_ENVIRONMENT_SLS_TEST: test
|
||||
DEPLOY_ENVIRONMENT_SLS_PRODUCTION: production
|
||||
DEPLOY_PATH_TEST: ${{ vars.DEPLOY_PATH_TEST }}
|
||||
DEPLOY_PATH_PRODUCTION: ${{ vars.DEPLOY_PATH_PRODUCTION }}
|
||||
SERVICE_NAME_TEST: ${{ vars.SERVICE_NAME_TEST }}
|
||||
@@ -55,24 +55,24 @@ jobs:
|
||||
config-sls:
|
||||
runs-on: linux
|
||||
outputs:
|
||||
artifact_name_test: ${{ steps.set.outputs.artifact_name_test }}
|
||||
artifact_name_production: ${{ steps.set.outputs.artifact_name_production }}
|
||||
deploy_environment_test: ${{ steps.set.outputs.deploy_environment_test }}
|
||||
deploy_environment_production: ${{ steps.set.outputs.deploy_environment_production }}
|
||||
deploy_path_test: ${{ steps.set.outputs.deploy_path_test }}
|
||||
deploy_path_production: ${{ steps.set.outputs.deploy_path_production }}
|
||||
service_name_test: ${{ steps.set.outputs.service_name_test }}
|
||||
service_name_production: ${{ steps.set.outputs.service_name_production }}
|
||||
health_check_url_test: ${{ steps.set.outputs.health_check_url_test }}
|
||||
health_check_url_production: ${{ steps.set.outputs.health_check_url_production }}
|
||||
artifact_name_sls_test: ${{ steps.set.outputs.artifact_name_sls_test }}
|
||||
artifact_name_sls_production: ${{ steps.set.outputs.artifact_name_sls_production }}
|
||||
deploy_environment_sls_test: ${{ steps.set.outputs.deploy_environment_sls_test }}
|
||||
deploy_environment_sls_production: ${{ steps.set.outputs.deploy_environment_sls_production }}
|
||||
deploy_path_sls_test: ${{ steps.set.outputs.deploy_path_sls_test }}
|
||||
deploy_path_sls_production: ${{ steps.set.outputs.deploy_path_sls_production }}
|
||||
service_name_sls_test: ${{ steps.set.outputs.service_name_sls_test }}
|
||||
service_name_sls_production: ${{ steps.set.outputs.service_name_sls_production }}
|
||||
health_check_url_sls_test: ${{ steps.set.outputs.health_check_url_sls_test }}
|
||||
health_check_url_sls_production: ${{ steps.set.outputs.health_check_url_sls_production }}
|
||||
steps:
|
||||
# Gitea has no reliable way to see a past run's workflow_dispatch input values from the UI, so
|
||||
# this logs them explicitly — the only durable record of what was actually checked for a run.
|
||||
- name: Log dispatch inputs
|
||||
if: github.event_name == 'workflow_dispatch'
|
||||
run: |
|
||||
echo "Deploy to Test: ${{ github.event.inputs.deploy_test }}"
|
||||
echo "Deploy to Production: ${{ github.event.inputs.deploy_production }}"
|
||||
echo "Deploy SLS test: ${{ github.event.inputs.deploy_sls_test }}"
|
||||
echo "Deploy SLS production: ${{ github.event.inputs.deploy_sls_production }}"
|
||||
# The Gitea variables are read at STEP level (like config-asf), not through the workflow-level env block: on the PC
|
||||
# runner the workflow-level `${{ vars.* }}` values came through empty (deploy path "" -> mkdir /releases), while
|
||||
# step-level env works on both runners. The test trio must be set, otherwise fail here instead of in the deploy.
|
||||
@@ -91,16 +91,16 @@ jobs:
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
echo "artifact_name_test=${{ env.ARTIFACT_NAME_TEST }}" >> "$GITHUB_OUTPUT"
|
||||
echo "artifact_name_production=${{ env.ARTIFACT_NAME_PRODUCTION }}" >> "$GITHUB_OUTPUT"
|
||||
echo "deploy_environment_test=${{ env.DEPLOY_ENVIRONMENT_TEST }}" >> "$GITHUB_OUTPUT"
|
||||
echo "deploy_environment_production=${{ env.DEPLOY_ENVIRONMENT_PRODUCTION }}" >> "$GITHUB_OUTPUT"
|
||||
echo "deploy_path_test=$DEPLOY_PATH_TEST" >> "$GITHUB_OUTPUT"
|
||||
echo "deploy_path_production=$DEPLOY_PATH_PRODUCTION" >> "$GITHUB_OUTPUT"
|
||||
echo "service_name_test=$SERVICE_NAME_TEST" >> "$GITHUB_OUTPUT"
|
||||
echo "service_name_production=$SERVICE_NAME_PRODUCTION" >> "$GITHUB_OUTPUT"
|
||||
echo "health_check_url_test=$HEALTH_CHECK_URL_TEST" >> "$GITHUB_OUTPUT"
|
||||
echo "health_check_url_production=$HEALTH_CHECK_URL_PRODUCTION" >> "$GITHUB_OUTPUT"
|
||||
echo "artifact_name_sls_test=${{ env.ARTIFACT_NAME_SLS_TEST }}" >> "$GITHUB_OUTPUT"
|
||||
echo "artifact_name_sls_production=${{ env.ARTIFACT_NAME_SLS_PRODUCTION }}" >> "$GITHUB_OUTPUT"
|
||||
echo "deploy_environment_sls_test=${{ env.DEPLOY_ENVIRONMENT_SLS_TEST }}" >> "$GITHUB_OUTPUT"
|
||||
echo "deploy_environment_sls_production=${{ env.DEPLOY_ENVIRONMENT_SLS_PRODUCTION }}" >> "$GITHUB_OUTPUT"
|
||||
echo "deploy_path_sls_test=$DEPLOY_PATH_TEST" >> "$GITHUB_OUTPUT"
|
||||
echo "deploy_path_sls_production=$DEPLOY_PATH_PRODUCTION" >> "$GITHUB_OUTPUT"
|
||||
echo "service_name_sls_test=$SERVICE_NAME_TEST" >> "$GITHUB_OUTPUT"
|
||||
echo "service_name_sls_production=$SERVICE_NAME_PRODUCTION" >> "$GITHUB_OUTPUT"
|
||||
echo "health_check_url_sls_test=$HEALTH_CHECK_URL_TEST" >> "$GITHUB_OUTPUT"
|
||||
echo "health_check_url_sls_production=$HEALTH_CHECK_URL_PRODUCTION" >> "$GITHUB_OUTPUT"
|
||||
|
||||
# Path-based skip: keeps the pipeline short when a change only touches one side of the repo.
|
||||
# fetch-depth: 0 gives paths-filter full local git history to diff against, rather than relying
|
||||
@@ -365,7 +365,7 @@ jobs:
|
||||
# but a gate that actually ran and failed or was cancelled still blocks the publish. The
|
||||
# changes.outputs check makes sure there's something to publish at all: a run that touched
|
||||
# neither backend nor frontend has nothing new to deploy. The final line skips this build on a
|
||||
# manual workflow_dispatch run that didn't check deploy_test — building and uploading a test
|
||||
# manual workflow_dispatch run that didn't check deploy_sls_test — building and uploading a test
|
||||
# artifact nobody is going to deploy is wasted work; push/PR runs are unaffected.
|
||||
if: |
|
||||
always() &&
|
||||
@@ -377,7 +377,7 @@ jobs:
|
||||
needs.frontend-test.result != 'failure' && needs.frontend-test.result != 'cancelled' &&
|
||||
needs.frontend-lint.result != 'failure' && needs.frontend-lint.result != 'cancelled' &&
|
||||
(needs.changes.outputs.backend == 'true' || needs.changes.outputs.frontend == 'true') &&
|
||||
(github.event_name != 'workflow_dispatch' || github.event.inputs.deploy_test == 'true')
|
||||
(github.event_name != 'workflow_dispatch' || github.event.inputs.deploy_sls_test == 'true')
|
||||
runs-on: linux
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
@@ -428,16 +428,16 @@ jobs:
|
||||
working-directory: src/SlpModularCms.Api.SlpSoftware
|
||||
run: >
|
||||
dotnet publish -c Release -r ${{ env.PUBLISH_RID }} --self-contained false
|
||||
-o ${{ github.workspace }}/${{ env.ARTIFACT_NAME_TEST }}
|
||||
-o ${{ github.workspace }}/${{ env.ARTIFACT_NAME_SLS_TEST }}
|
||||
|
||||
- name: Upload publish artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ env.ARTIFACT_NAME_TEST }}
|
||||
path: ${{ env.ARTIFACT_NAME_TEST }}
|
||||
name: ${{ env.ARTIFACT_NAME_SLS_TEST }}
|
||||
path: ${{ env.ARTIFACT_NAME_SLS_TEST }}
|
||||
retention-days: 1
|
||||
|
||||
# Same as publish-sls-test, but only for a manual workflow_dispatch run with deploy_production set —
|
||||
# Same as publish-sls-test, but only for a manual workflow_dispatch run with deploy_sls_production set —
|
||||
# a distinct job rather than a parameterized reuse of publish-sls-test, because VITE_APP_ENV is a
|
||||
# Vite build-time value: one dist/ bundle cannot be tagged as both 'test' and 'production' (FR-05).
|
||||
publish-sls-production:
|
||||
@@ -453,7 +453,7 @@ jobs:
|
||||
needs.frontend-build.result != 'failure' && needs.frontend-build.result != 'cancelled' &&
|
||||
needs.frontend-test.result != 'failure' && needs.frontend-test.result != 'cancelled' &&
|
||||
needs.frontend-lint.result != 'failure' && needs.frontend-lint.result != 'cancelled' &&
|
||||
github.event_name == 'workflow_dispatch' && github.event.inputs.deploy_production == 'true' &&
|
||||
github.event_name == 'workflow_dispatch' && github.event.inputs.deploy_sls_production == 'true' &&
|
||||
(needs.changes.outputs.backend == 'true' || needs.changes.outputs.frontend == 'true')
|
||||
runs-on: linux
|
||||
steps:
|
||||
@@ -499,17 +499,17 @@ jobs:
|
||||
working-directory: src/SlpModularCms.Api.SlpSoftware
|
||||
run: >
|
||||
dotnet publish -c Release -r ${{ env.PUBLISH_RID }} --self-contained false
|
||||
-o ${{ github.workspace }}/${{ env.ARTIFACT_NAME_PRODUCTION }}
|
||||
-o ${{ github.workspace }}/${{ env.ARTIFACT_NAME_SLS_PRODUCTION }}
|
||||
|
||||
- name: Upload publish artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ env.ARTIFACT_NAME_PRODUCTION }}
|
||||
path: ${{ env.ARTIFACT_NAME_PRODUCTION }}
|
||||
name: ${{ env.ARTIFACT_NAME_SLS_PRODUCTION }}
|
||||
path: ${{ env.ARTIFACT_NAME_SLS_PRODUCTION }}
|
||||
retention-days: 1
|
||||
|
||||
# Automatic test deploy on every push to master (unchanged — a merge should reach test without
|
||||
# extra steps). A manual workflow_dispatch run only deploys to test when deploy_test is checked,
|
||||
# extra steps). A manual workflow_dispatch run only deploys to test when deploy_sls_test is checked,
|
||||
# since a dispatch run is often just re-running CI/production, not a new test build (FR-03, D-01,
|
||||
# D-09).
|
||||
# deploy_path / service_name / health_check_url come straight from the Gitea variables, NOT from the `config-sls` job
|
||||
@@ -518,28 +518,28 @@ jobs:
|
||||
# `config-sls` outputs are still used for the artifact and environment names.
|
||||
deploy-sls-test:
|
||||
needs: [publish-sls-test, config-sls]
|
||||
if: (github.event_name == 'workflow_dispatch' && github.event.inputs.deploy_test == 'true') || (github.event_name == 'push' && github.ref == 'refs/heads/master')
|
||||
if: (github.event_name == 'workflow_dispatch' && github.event.inputs.deploy_sls_test == 'true') || (github.event_name == 'push' && github.ref == 'refs/heads/master')
|
||||
uses: ./.gitea/workflows/deploy-scp.yaml
|
||||
secrets: inherit
|
||||
with:
|
||||
artifact_name: ${{ needs.config-sls.outputs.artifact_name_test }}
|
||||
environment: ${{ needs.config-sls.outputs.deploy_environment_test }}
|
||||
artifact_name: ${{ needs.config-sls.outputs.artifact_name_sls_test }}
|
||||
environment: ${{ needs.config-sls.outputs.deploy_environment_sls_test }}
|
||||
deploy_path: ${{ vars.DEPLOY_PATH_TEST }}
|
||||
service_name: ${{ vars.SERVICE_NAME_TEST }}
|
||||
health_check_url: ${{ vars.HEALTH_CHECK_URL_TEST }}
|
||||
run_db_backup: false
|
||||
|
||||
# Production deploy ONLY on an explicit workflow_dispatch run with deploy_production checked
|
||||
# Production deploy ONLY on an explicit workflow_dispatch run with deploy_sls_production checked
|
||||
# (FR-04, D-09) — never reachable from a plain push to master, so pushing cannot deploy production
|
||||
# under any circumstance.
|
||||
deploy-sls-production:
|
||||
needs: [publish-sls-production, config-sls]
|
||||
if: github.event_name == 'workflow_dispatch' && github.event.inputs.deploy_production == 'true'
|
||||
if: github.event_name == 'workflow_dispatch' && github.event.inputs.deploy_sls_production == 'true'
|
||||
uses: ./.gitea/workflows/deploy-scp.yaml
|
||||
secrets: inherit
|
||||
with:
|
||||
artifact_name: ${{ needs.config-sls.outputs.artifact_name_production }}
|
||||
environment: ${{ needs.config-sls.outputs.deploy_environment_production }}
|
||||
artifact_name: ${{ needs.config-sls.outputs.artifact_name_sls_production }}
|
||||
environment: ${{ needs.config-sls.outputs.deploy_environment_sls_production }}
|
||||
deploy_path: ${{ vars.DEPLOY_PATH_PRODUCTION }}
|
||||
service_name: ${{ vars.SERVICE_NAME_PRODUCTION }}
|
||||
health_check_url: ${{ vars.HEALTH_CHECK_URL_PRODUCTION }}
|
||||
|
||||
+3
-3
@@ -530,9 +530,9 @@ Current compact overview, including the ASF test jobs and deploying a branch: `d
|
||||
|
||||
Already built (U5/U6) — this is the read-only walkthrough for whoever operates it:
|
||||
|
||||
1. Push to `master`, or a manual `workflow_dispatch` (inputs `deploy_test`, `deploy_production`, `deploy_asf_test`, all off by default) → the gates run (`changes`, `backend-build`, `backend-test`, `vulnerability-scan`, `frontend-prepare`, `frontend-build`, `frontend-test`, `frontend-lint`)
|
||||
2. `publish-sls-test` runs on a push to `master`, on pull requests (build only, no deploy) and on a dispatch with `deploy_test`; `publish-sls-production` only on a dispatch with `deploy_production`
|
||||
3. `deploy-sls-test` (on a push to `master`, or a dispatch with `deploy_test`; not on pull requests) calls `deploy-scp.yaml`, which uploads into a new
|
||||
1. Push to `master`, or a manual `workflow_dispatch` (inputs `deploy_sls_test`, `deploy_sls_production`, `deploy_asf_test`, all off by default) → the gates run (`changes`, `backend-build`, `backend-test`, `vulnerability-scan`, `frontend-prepare`, `frontend-build`, `frontend-test`, `frontend-lint`)
|
||||
2. `publish-sls-test` runs on a push to `master`, on pull requests (build only, no deploy) and on a dispatch with `deploy_sls_test`; `publish-sls-production` only on a dispatch with `deploy_sls_production`
|
||||
3. `deploy-sls-test` (on a push to `master`, or a dispatch with `deploy_sls_test`; not on pull requests) calls `deploy-scp.yaml`, which uploads into a new
|
||||
`releases/{timestamp}/`, links `shared/wwwroot-web` and any `shared/modules/*.dll` in, switches
|
||||
`current`, restarts `slpsoftware-test.service`, verifies `https://test.slpsoftware.nl/health`,
|
||||
then prunes old releases (only test — `run_db_backup: false`)
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ procedure.
|
||||
| Environment | Host | Domain | Trigger |
|
||||
|---|---|---|---|
|
||||
| Test | Raspberry Pi (`linux-arm64`) | `test.slpsoftware.nl` | Automatic on push to `master`, or any `workflow_dispatch` |
|
||||
| Production | Same Pi, separate directory | `slpsoftware.nl` | Only `workflow_dispatch` with `deploy_production = true` |
|
||||
| Production | Same Pi, separate directory | `slpsoftware.nl` | Only `workflow_dispatch` with `deploy_sls_production = true` |
|
||||
|
||||
Same physical host for both (per `infrastructure-design.md` § 1) — separated by directory,
|
||||
`systemd --user` unit, and local port, never by anything the workflow manages directly.
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ If the defect predates the retained previous release, redeploy an **earlier comm
|
||||
normal pipeline:
|
||||
|
||||
1. `git revert` or check out the last-known-good commit on a branch
|
||||
2. Push to `master` (test) or run `workflow_dispatch` with `deploy_production: true` (production) —
|
||||
2. Push to `master` (test) or run `workflow_dispatch` with `deploy_sls_production: true` (production) —
|
||||
the same gates and deploy sequence run as any other deploy
|
||||
3. This only works because migrations are required to be forward-compatible and non-destructive
|
||||
(D-26) — redeploying an older commit's code against a database that has since had newer
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ producing the operational documentation around it, not re-deciding the method:
|
||||
services, no sudo (`infrastructure-design.md` §§ 2–3)
|
||||
- **Rollback mechanism**: re-point the `current` symlink to the previous release and restart the
|
||||
service — already fully specified, this stage just needs to write it up as a runnable procedure
|
||||
- **Approval gate for production**: the `workflow_dispatch` + `deploy_production` flag itself is the
|
||||
- **Approval gate for production**: the `workflow_dispatch` + `deploy_sls_production` flag itself is the
|
||||
approval gate (D-09) — no additional gate is needed
|
||||
|
||||
## Question 1: Include Deployment Setup?
|
||||
|
||||
@@ -26,15 +26,15 @@ Poorten (jobs): `changes` (pad-filter), `backend-build`, `backend-test` (met een
|
||||
|
||||
| Invoer | Standaard | Effect |
|
||||
|---|---|---|
|
||||
| `deploy_test` | uit | Bouwt (`publish-sls-test`) en deployt naar SlpSoftware test |
|
||||
| `deploy_production` | uit | Bouwt (`publish-sls-production`) en deployt naar SlpSoftware productie, met databaseback-up vooraf |
|
||||
| `deploy_sls_test` | uit | Bouwt (`publish-sls-test`) en deployt naar SlpSoftware test |
|
||||
| `deploy_sls_production` | uit | Bouwt (`publish-sls-production`) en deployt naar SlpSoftware productie, met databaseback-up vooraf |
|
||||
| `deploy_asf_test` | uit | Bouwt (`publish-asf-test`) en deployt naar ASF test; alleen als ook `ASF_TEST_DEPLOY_ENABLED` op `true` staat |
|
||||
|
||||
Zonder een van de drie aangevinkt draaien alleen de poorten (handig als losse CI-run). Meerdere tegelijk aanvinken kan. Let op: `deploy_production` is aan de `master`-branch niet gebonden in de workflow: de conditie van `deploy-sls-production` controleert alleen de gebeurtenis en de invoer, niet de branch (zie `ci`, job `deploy-sls-production`).
|
||||
Zonder een van de drie aangevinkt draaien alleen de poorten (handig als losse CI-run). Meerdere tegelijk aanvinken kan. Let op: `deploy_sls_production` is aan de `master`-branch niet gebonden in de workflow: de conditie van `deploy-sls-production` controleert alleen de gebeurtenis en de invoer, niet de branch (zie `ci`, job `deploy-sls-production`).
|
||||
|
||||
## Jobnamen en branch protection (merge-checklist)
|
||||
|
||||
Jobnamen volgen `{actie}-{site}-{omgeving}`: `config-sls`, `publish-sls-test`, `deploy-sls-test`, `publish-sls-production`, `deploy-sls-production` en voor Andrea `config-asf`, `publish-asf-test`, `deploy-asf-test`. De invoeren van de handmatige run (`deploy_test`, `deploy_production`, `deploy_asf_test`) hebben niet van naam gewisseld.
|
||||
Jobnamen volgen `{actie}-{site}-{omgeving}`: `config-sls`, `publish-sls-test`, `deploy-sls-test`, `publish-sls-production`, `deploy-sls-production` en voor Andrea `config-asf`, `publish-asf-test`, `deploy-asf-test`. Ook de invoeren van de handmatige run hebben de sitenaam: `deploy_sls_test`, `deploy_sls_production` en `deploy_asf_test` (vroeger `deploy_test` en `deploy_production`). De uitvoer van `config-sls` heet `artifact_name_sls_*`, `deploy_environment_sls_*`, `deploy_path_sls_*`, `service_name_sls_*` en `health_check_url_sls_*`, de artefacten `app-sls-test` en `app-sls-production` (ASF: `app-asf-test`). De Gitea-variabelen en -secrets (bijv. `DEPLOY_PATH_TEST`) zijn niet hernoemd.
|
||||
|
||||
Branch protection op `master` vereist de checks `Continuous Integration / backend-test (pull_request)`, `frontend-test (pull_request)` en een publish-check. **Die derde check heette vroeger `publish-test (pull_request)` en moet nu `publish-sls-test (pull_request)` heten** (Gitea: repository, Instellingen, Branches, beschermde branch `master`, vereiste statuschecks). Pas dat vlak voor de merge aan, met Bryans go; tot dan zou een merge wachten op een check die niet meer bestaat.
|
||||
|
||||
@@ -42,7 +42,7 @@ Branch protection op `master` vereist de checks `Continuous Integration / backen
|
||||
|
||||
1. Gitea, repository, Actions, workflow "Continuous Integration", "Run workflow".
|
||||
2. Kies de branch (de workflow bouwt en deployt de code van de gekozen ref; `actions/checkout` zonder `ref`).
|
||||
3. Vink `deploy_test` aan (SlpSoftware test) en/of `deploy_asf_test` (ASF test). Laat `deploy_production` uit.
|
||||
3. Vink `deploy_sls_test` aan (SlpSoftware test) en/of `deploy_asf_test` (ASF test). Laat `deploy_sls_production` uit.
|
||||
4. Na een groene run controleert de deploy zelf `/health`; kijk daarna zelf op de testhost.
|
||||
|
||||
Aandachtspunten:
|
||||
|
||||
Reference in New Issue
Block a user