Production upload: plain FTP (no FTPS), no web.config from this repo, optional port
Continuous Integration / check (pull_request) Successful in 4m12s
Continuous Integration / build-test (pull_request) Skipped
Continuous Integration / deploy-test (pull_request) Skipped
Continuous Integration / lighthouse (pull_request) Successful in 44m28s
Continuous Integration / deploy-production (pull_request) Skipped
Continuous Integration / check (pull_request) Successful in 4m12s
Continuous Integration / build-test (pull_request) Skipped
Continuous Integration / deploy-test (pull_request) Skipped
Continuous Integration / lighthouse (pull_request) Successful in 44m28s
Continuous Integration / deploy-production (pull_request) Skipped
The production package only offers plain FTP. The upload goes into the prerendered-pages folder of the CMS host; the host and its web.config come from the CMS pipeline. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
# Upload naar productie in drie rondes (BR-HST-14, 15; FR-PR-18).
|
||||
# Gebruik: upload-production.sh <dist-map> <doelmap-op-de-server>
|
||||
# Verbinding: FTP_HOST, FTP_USER en LFTP_PASSWORD uit de omgeving (FTPS).
|
||||
# De doelmap is de map met voorgerenderde pagina's van de CMS-host; de host
|
||||
# (en zijn web.config) staat er los van en wordt door de CMS-pijplijn gedeployd.
|
||||
# Verbinding: FTP_HOST, FTP_USER en LFTP_PASSWORD uit de omgeving, optioneel
|
||||
# FTP_PORT. Gewone FTP, geen FTPS: het productiepakket biedt alleen dat. De
|
||||
# gegevens gaan dus onversleuteld over het netwerk (zie docs/deploy-and-ci.md,
|
||||
# "Plain FTP"); daarom nooit TLS proberen en een eigen FTP-account met rechten
|
||||
# alleen op deze map.
|
||||
# Alleen voor de test: LFTP_OPEN (bijvoorbeeld file:///) vervangt de
|
||||
# verbinding, en UPLOAD_PASS=1|2|3 voert maar één ronde uit.
|
||||
set -euo pipefail
|
||||
@@ -36,7 +42,6 @@ done
|
||||
|
||||
here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
bash "$here/check-artifact.sh" "$dist"
|
||||
cp "$here/iis/web.config" "$dist/web.config"
|
||||
|
||||
pass="${UPLOAD_PASS:-all}"
|
||||
case "$pass" in
|
||||
@@ -48,7 +53,7 @@ wants() { [ "$pass" = all ] || [ "$pass" = "$1" ]; }
|
||||
# Geen back-ups: lftp zet standaard een kopie met een tijdstempel
|
||||
# (web.config~20261101221045~) naast elk bestand dat het overschrijft. Op de
|
||||
# host zou elke deploy er een achterlaten, bereikbaar voor wie de naam raadt.
|
||||
settings="set ftp:ssl-force true; set ftp:ssl-protect-data true; set net:max-retries 3; set xfer:make-backup no;"
|
||||
settings="set ftp:ssl-allow no; set ftp:passive-mode on; set net:max-retries 3; set xfer:make-backup no;"
|
||||
|
||||
# Elke opdracht krijgt een eigen lftp-sessie, zodat het script bij een mislukte
|
||||
# ronde stopt (set -e) voordat de volgende ronde begint: de HTML gaat nooit
|
||||
@@ -60,22 +65,25 @@ run_lftp() {
|
||||
else
|
||||
: "${FTP_HOST:?FTP_HOST ontbreekt}" "${FTP_USER:?FTP_USER ontbreekt}"
|
||||
: "${LFTP_PASSWORD:?LFTP_PASSWORD ontbreekt}"
|
||||
lftp --env-password -u "$FTP_USER" "$FTP_HOST" -e "$commands"
|
||||
local port=()
|
||||
if [ -n "${FTP_PORT:-}" ]; then
|
||||
[[ "$FTP_PORT" =~ ^[0-9]+$ ]] || { echo "Ongeldige FTP_PORT" >&2; exit 2; }
|
||||
port=(-p "$FTP_PORT")
|
||||
fi
|
||||
lftp --env-password -u "$FTP_USER" "${port[@]}" "$FTP_HOST" -e "$commands"
|
||||
fi
|
||||
}
|
||||
|
||||
# Ronde 1: alles behalve HTML en web.config, dus ook /assets. Nieuwe
|
||||
# bestanden met hash in de naam storen de oude release niet.
|
||||
# Ronde 1: alles behalve HTML, dus ook /assets. Nieuwe bestanden met hash in
|
||||
# de naam storen de oude release niet.
|
||||
if wants 1; then
|
||||
echo "== Ronde 1: alles behalve HTML en web.config"
|
||||
run_lftp "mirror --reverse --verbose --exclude-glob '*.html' --exclude-glob web.config $dist/ $remote/;"
|
||||
echo "== Ronde 1: alles behalve HTML"
|
||||
run_lftp "mirror --reverse --verbose --exclude-glob '*.html' $dist/ $remote/;"
|
||||
fi
|
||||
# Ronde 2: web.config vlak voor de HTML (de regels passen bij de nieuwe
|
||||
# bestanden), dan alle HTML, ook de geneste pagina's en 404.html. Pas nu
|
||||
# verwijst iets naar de nieuwe assets.
|
||||
# Ronde 2: alle HTML, ook de geneste pagina's en 404.html. Pas nu verwijst
|
||||
# iets naar de nieuwe assets.
|
||||
if wants 2; then
|
||||
echo "== Ronde 2: web.config en alle HTML"
|
||||
run_lftp "put -O $remote $dist/web.config;"
|
||||
echo "== Ronde 2: alle HTML"
|
||||
run_lftp "mirror --reverse --verbose --include-glob '*.html' $dist/ $remote/;"
|
||||
fi
|
||||
# Ronde 3: opruimen als laatste, zodat bezoekers met de oude HTML hun oude
|
||||
|
||||
Reference in New Issue
Block a user