ci(wiki): canonize wiki content Gitea->git.lab (ADR-0015)

Add canonize_wiki to the daily schedule: bare-clone the public Gitea wiki repo
(sorb/ThreadNetWiki) and push its main to git.lab axion1337.chat/threadnet-wiki,
closing the second half of ADR-0015 (Wiki.js->Gitea->canonize->git.lab, the same
reversal as the TURN rotation). The target was created empty, so the first push
creates main and later runs fast-forward — no force, branch protection intact.
Auth via the WIKI_CANONIZE_TOKEN CI variable (project token, write_repository).
This commit is contained in:
Thore Cimbal
2026-08-13 12:00:00 +00:00
parent ece80a8153
commit dbc7dacf2a
+41
View File
@@ -121,3 +121,44 @@ canonize_rotation:
git push "https://oauth2:${CANONIZE_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git" HEAD:main git push "https://oauth2:${CANONIZE_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git" HEAD:main
echo "Gepusht. Der Mirror traegt es nach Gitea zurueck, der PR schliesst sich dort selbst;" echo "Gepusht. Der Mirror traegt es nach Gitea zurueck, der PR schliesst sich dort selbst;"
echo "der Rotations-Branch existiert dann nur noch auf Gitea und wird vom Mirror entfernt." echo "der Rotations-Branch existiert dann nur noch auf Gitea und wird vom Mirror entfernt."
# ---------------------------------------------------------------------------
# Wiki-Inhalt kanonisieren (laeuft NUR als Pipeline-Schedule, ADR-0015)
#
# Wiki.js laeuft im Cluster und erreicht git.lab nicht - es pusht seinen Inhalt
# deshalb nach Gitea (sorb/ThreadNetWiki, oeffentlich lesbar). Dieser Job spiegelt
# den Stand von dort nach git.lab axion1337.chat/threadnet-wiki, damit der
# kanonische Speicher wieder im Lab liegt. Gleiche Umkehrung wie die TURN-Rotation.
#
# Einrichtung:
# 1. ERLEDIGT: Project Access Token (Rolle Maintainer, Scope write_repository) auf
# axion1337.chat/threadnet-wiki -> gitops-CI/CD-Variable WIKI_CANONIZE_TOKEN
# (masked + protected).
# 2. Schedule: laeuft im bestehenden Tages-Schedule mit (CI_PIPELINE_SOURCE ==
# "schedule"). threadnet-wiki wurde leer angelegt -> der erste Push legt main an,
# danach nur noch Fast-Forward (kein Force, Branch-Protection bleibt).
canonize_wiki:
image: alpine:3.20
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
variables:
GIT_DEPTH: "1" # nur fuer ci/lab-ca-chain.crt aus dem ausgecheckten Repo
script:
- apk add --no-cache git ca-certificates >/dev/null
- |
# Lab-CA fuer den git.lab-Push; der Gitea-Klon nutzt die System-CA (oeffentliches Zert).
if [ -n "$CI_SERVER_TLS_CA_FILE" ] && [ -f "$CI_SERVER_TLS_CA_FILE" ]; then
LABCA="$CI_SERVER_TLS_CA_FILE"
else
LABCA="$CI_PROJECT_DIR/ci/lab-ca-chain.crt"
fi
test -f "$LABCA" || { echo "ABBRUCH: Lab-CA-Datei fehlt."; exit 1; }
if [ -z "$WIKI_CANONIZE_TOKEN" ]; then
echo "ABBRUCH: WIKI_CANONIZE_TOKEN nicht gesetzt (siehe Kopf, Einrichtungsschritt 1)."
exit 1
fi
- git config --global user.email "ci@axion1337.chat"
- git config --global user.name "ThreadNet-Wiki Kanonisierung"
- git clone --bare --quiet https://rohana.axion1337.de/sorb/ThreadNetWiki.git /tmp/wiki.git
- GIT_SSL_CAINFO="$LABCA" git -C /tmp/wiki.git push "https://oauth2:${WIKI_CANONIZE_TOKEN}@${CI_SERVER_HOST}/axion1337.chat/threadnet-wiki.git" 'refs/heads/main:refs/heads/main'
- echo "git.lab threadnet-wiki spiegelt jetzt Gitea sorb/ThreadNetWiki (main)."