Mediabibliotheek en Hero: kopie-schakelaar in de deploy-workflow (test), kiezer enkel en meervoud, hint bij gedeelde uitsnede, plan uitsnede per gebruik
Continuous Integration / config-sls (pull_request) Successful in 8s
Continuous Integration / config-asf (pull_request) Successful in 6s
Continuous Integration / changes (pull_request) Successful in 13s
Continuous Integration / backend-build (pull_request) Successful in 1m53s
Continuous Integration / compile-sites (pull_request) Successful in 1m54s
Continuous Integration / vulnerability-scan (pull_request) Successful in 1m56s
Continuous Integration / frontend-prepare (pull_request) Successful in 2m24s
Continuous Integration / frontend-build (pull_request) Successful in 35s
Continuous Integration / frontend-lint (pull_request) Successful in 38s
Continuous Integration / backend-test (pull_request) Successful in 4m18s
Continuous Integration / frontend-test (pull_request) Successful in 2m35s
Continuous Integration / publish-sls-test (pull_request) Skipped
Continuous Integration / publish-sls-production (pull_request) Skipped
Continuous Integration / deploy-sls-test (pull_request) Skipped
Continuous Integration / deploy-sls-production (pull_request) Skipped
Continuous Integration / publish-asf-test (pull_request) Skipped
Continuous Integration / deploy-asf-test (pull_request) Skipped
Continuous Integration / smoke-sls-test (pull_request) Skipped
Continuous Integration / smoke-asf-test (pull_request) Skipped

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-17 17:20:09 +01:00
co-authored by Claude Sonnet 5.5
parent e09304c2e9
commit 9bc4153c70
11 changed files with 228 additions and 23 deletions
@@ -15,6 +15,11 @@ on:
description: 'Deploy ASF test (Andrea Slop Fotografie)'
type: boolean
default: false
media_library_copy:
description: 'Media library copy on the TEST deploys (Media__Library__CopyOnStartup in shared/env): unchanged, on or off'
type: choice
options: [unchanged, 'on', 'off']
default: unchanged
pull_request:
types: [opened, synchronize, reopened]
push:
@@ -555,6 +560,7 @@ jobs:
service_name: ${{ vars.SERVICE_NAME_TEST }}
health_check_url: ${{ vars.HEALTH_CHECK_URL_TEST }}
run_db_backup: false
media_library_copy: ${{ github.event.inputs.media_library_copy || 'unchanged' }}
# Production deploy ONLY on an explicit workflow_dispatch run with deploy_sls_production checked, and
# only when that run is on a release/* branch (same rule as ASF) — never reachable from a plain push
@@ -682,6 +688,7 @@ jobs:
service_name: ${{ vars.SERVICE_NAME_ASF_TEST }}
health_check_url: ${{ vars.HEALTH_CHECK_URL_ASF_TEST }}
run_db_backup: false
media_library_copy: ${{ github.event.inputs.media_library_copy || 'unchanged' }}
# --- Smoke tests of the deployed compositions (anonymous requests, see scripts/smoke-site.sh) ---
# The CI tests the master CMS; this is the check that the composition of each site that was just deployed to test
+50
View File
@@ -37,6 +37,11 @@ on:
required: false
type: string
default: scp
media_library_copy:
description: 'unchanged | on | off: sets Media__Library__CopyOnStartup in shared/env before the restart. TEST only, never production.'
required: false
type: string
default: unchanged
jobs:
deploy:
@@ -211,6 +216,37 @@ jobs:
ln -sf \"../../shared/modules/\$name\" \"$RELEASE_DIR/\$name\"; \
done"
# The media library copy switch (migration plan of the media library, decision 13): the application reads
# Media__Library__CopyOnStartup from the host environment file shared/env (D-16). The deploy account can edit that file,
# nobody else needs a shell on the host. Only this ONE key is touched (nothing else of the file is read or printed, the
# file holds secrets), only on a test environment, and only with a value that is exactly on, off or unchanged.
# `on` makes the next start copy the photos into the library's tables and verify the copy (log line
# "Media library copy verified: N photos and M uses"); `off` removes the key again (the default is off).
- name: Set the media library copy switch (test only)
if: inputs.media_library_copy != 'unchanged'
env:
SSH_USER: ${{ secrets.PI_MAIN_USERNAME }}
SSH_PASS: ${{ secrets.PI_MAIN_PASSWORD }}
SSH_PORT: ${{ secrets.PI_MAIN_PORT }}
SSH_HOST: ${{ secrets.PI_MAIN_ADDRESS }}
run: |
MODE="${{ inputs.media_library_copy }}"
if [ "${{ inputs.environment }}" != "test" ]; then
echo "The media library copy switch is for the test environment only (environment: ${{ inputs.environment }})." >&2
exit 1
fi
if [ "$MODE" != "on" ] && [ "$MODE" != "off" ]; then
echo "media_library_copy must be unchanged, on or off (got: $MODE)." >&2
exit 1
fi
ENV_FILE="${{ inputs.deploy_path }}/shared/env"
if [ "$MODE" = "on" ]; then
rssh "touch $ENV_FILE && sed -i '/^Media__Library__CopyOnStartup=/d' $ENV_FILE && echo 'Media__Library__CopyOnStartup=true' >> $ENV_FILE"
else
rssh "touch $ENV_FILE && sed -i '/^Media__Library__CopyOnStartup=/d' $ENV_FILE"
fi
echo "Media__Library__CopyOnStartup is now: $(rssh "grep '^Media__Library__CopyOnStartup=' $ENV_FILE || echo '(not set = off)'")"
# Atomic release switch (FR-06, D-27): `ln -sfn` replaces the `current` symlink target in a
# single filesystem operation, so there is no moment where `current` points at a half-written
# directory. The process is then restarted so it picks up the new assemblies — a running .NET
@@ -227,6 +263,20 @@ jobs:
"ln -sfn $RELEASE_DIR ${{ inputs.deploy_path }}/current && \
systemctl --user restart ${{ inputs.service_name }}"
# After a restart with the copy on, show the verification line of the copy in this run's log (the journal of the user
# service), so nobody needs a shell on the host to see "Media library copy verified: N photos and M uses".
- name: Report the media library copy (test only)
if: inputs.media_library_copy == 'on'
env:
SSH_USER: ${{ secrets.PI_MAIN_USERNAME }}
SSH_PASS: ${{ secrets.PI_MAIN_PASSWORD }}
SSH_PORT: ${{ secrets.PI_MAIN_PORT }}
SSH_HOST: ${{ secrets.PI_MAIN_ADDRESS }}
run: |
sleep 20
rssh "journalctl --user -u ${{ inputs.service_name }} --since '-10 min' --no-pager 2>/dev/null | grep -E 'Media library copy|media library copy' | tail -5 || true"
echo "Look for 'Media library copy verified: N photos and M uses'. An error line means the copy was rolled back and nothing was copied."
# Verifies the restart actually produced a healthy process before this run is allowed to
# report success. Retries absorb process-startup time, which is about 10 seconds normally but
# 30 seconds or more when the host is busy (a migration step, two services restarting at once