ci: QA suite (repo+live), Gitea Actions workflow, app config-as-code
- qa/site-qa.sh: repo structure/link checks + full live crawl (routes, links, assets, canonical-https) - .gitea/workflows/qa.yml: repo QA on push, nightly live QA - app/: config-as-code for the deployed sync job, scheduler entry, and Grav system.yaml (reverse-proxy HTTPS detection) - local pre-push hook runs repo QA https://projects.knownelement.com/issues/928
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
#!/bin/bash
|
||||
# git-sync-job.sh v2 - deploy upstream, verify, roll back on failure.
|
||||
# Pull: if upstream moved -> deploy + clearcache + verify key routes; rollback on failure.
|
||||
# Push: if local pages edits exist -> commit + push (VpEngOps identity).
|
||||
cd /app/data/user || exit 1
|
||||
GIT=/usr/bin/git
|
||||
BASE="https://${CLOUDRON_APP_DOMAIN}"
|
||||
PORT="${CLOUDRON_APP_PORT:-80}"
|
||||
verify() { # returns 0 if key routes answer 200
|
||||
sleep 2
|
||||
for r in / /shop; do
|
||||
code=$(curl -s -o /dev/null -w '%{http_code}' -m 10 "http://127.0.0.1:${PORT}${r}" 2>/dev/null)
|
||||
[ "$code" != "200" ] && { echo "$(date -u +%FT%TZ) ALARM: route $r -> $code after deploy"; return 1; }
|
||||
done
|
||||
return 0
|
||||
}
|
||||
$GIT fetch origin main 2>/dev/null || exit 0
|
||||
LOCAL=$($GIT rev-parse HEAD 2>/dev/null || echo none)
|
||||
REMOTE=$($GIT rev-parse origin/main 2>/dev/null || echo none)
|
||||
if [ "$LOCAL" != "$REMOTE" ]; then
|
||||
if [ "$LOCAL" = "none" ]; then
|
||||
$GIT checkout -f -B main origin/main || exit 0
|
||||
else
|
||||
PREV=$LOCAL
|
||||
$GIT reset --hard origin/main || exit 0
|
||||
fi
|
||||
$GIT clean -fdq pages/ 2>/dev/null
|
||||
cd /app/code && php bin/grav clearcache >/dev/null 2>&1; cd /app/data/user
|
||||
if ! verify; then
|
||||
if [ -n "${PREV:-}" ]; then
|
||||
$GIT reset --hard "$PREV" && $GIT clean -fdq pages/ 2>/dev/null
|
||||
cd /app/code && php bin/grav clearcache >/dev/null 2>&1
|
||||
echo "$(date -u +%FT%TZ) rolled back to $PREV"
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
echo "$(date -u +%FT%TZ) deployed $REMOTE"
|
||||
exit 0
|
||||
fi
|
||||
if ! $GIT diff --quiet || ! $GIT diff --cached --quiet; then
|
||||
$GIT add pages/
|
||||
$GIT -c user.name=VpEngOps -c user.email=tsgstaff-coo-vpengops@turnsys.com commit -qm '(Grav site) content changes' || exit 0
|
||||
fi
|
||||
$GIT push origin main 2>/dev/null && echo "$(date -u +%FT%TZ) pushed" || true
|
||||
@@ -0,0 +1,4 @@
|
||||
enabled: true
|
||||
run_at: '*/15 * * * *'
|
||||
command: /bin/bash /app/data/git-sync-job.sh
|
||||
output: logs/git-sync-job.log
|
||||
@@ -0,0 +1,14 @@
|
||||
site:
|
||||
title: 'Rogue Technologies'
|
||||
description: 'Fabrication, printing, and maker services in San Antonio, TX.'
|
||||
author:
|
||||
name: 'VpEngOps'
|
||||
email: 'tsgstaff-coo-vpengops@turnsys.com'
|
||||
reverse_proxy_setup: true
|
||||
http_x_forwarded:
|
||||
protocol: true
|
||||
host: true
|
||||
debugger:
|
||||
enabled: false
|
||||
errors:
|
||||
display: false
|
||||
Reference in New Issue
Block a user