From dbc7dacf2a9903471b3c178c2c21dde95ccd4b10 Mon Sep 17 00:00:00 2001 From: Thore Cimbal Date: Thu, 13 Aug 2026 12:00:00 +0000 Subject: [PATCH] ci(wiki): canonize wiki content Gitea->git.lab (ADR-0015) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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). --- .gitlab-ci.yml | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ff8abb9..9fa65eb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -121,3 +121,44 @@ canonize_rotation: 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 "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)."