From e055ec511d124c6ae9fc8130c6cf175e4af4a61e Mon Sep 17 00:00:00 2001 From: Thore Cimbal Date: Wed, 19 Aug 2026 12:00:00 +0000 Subject: [PATCH] ci: temporary probe that CANONIZE_TOKEN reaches the pipeline Runs only on a web pipeline started with TEST_CANONIZE=1, pushes a throwaway ref and deletes it again, and never touches main. Removed after the test. Co-Authored-By: Claude Opus 5 --- .gitlab-ci.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 37bf76d..f18788c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -200,3 +200,37 @@ canonize_wiki: - 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)." + +# --------------------------------------------------------------------------- +# TEMPORAER (2026-08-19): beweist, dass CANONIZE_TOKEN in der Pipeline ankommt +# und schreiben darf - OHNE main anzufassen. Laeuft nur, wenn eine Web-Pipeline +# ausdruecklich mit TEST_CANONIZE=1 gestartet wird. Wird nach dem Test entfernt. +# --------------------------------------------------------------------------- +canonize_token_test: + stage: pruefen + image: alpine:3.20 + rules: + - if: $CI_PIPELINE_SOURCE == "web" && $TEST_CANONIZE == "1" + script: + - apk add --no-cache git ca-certificates >/dev/null + - export GIT_SSL_CAINFO="$CI_PROJECT_DIR/ci/lab-ca-chain.crt" + - | + if [ -z "$CANONIZE_TOKEN" ]; then + echo "FEHLT: CANONIZE_TOKEN ist im Job nicht sichtbar." + echo "Ursache meist: Variable 'protected', Pipeline laeuft aber auf einem" + echo "ungeschuetzten Branch. Genau dann bliebe die Rotation liegen." + exit 1 + fi + echo "Sichtbar: CANONIZE_TOKEN ist im Job gesetzt." + URL="https://oauth2:${CANONIZE_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git" + REF="canonize-token-probe-${CI_PIPELINE_ID}" + # Ausgabe wird gefiltert: git schreibt die URL bei Fehlern mit ins Log. + if git push "$URL" "HEAD:refs/heads/$REF" 2>&1 | sed 's#oauth2:[^@]*@#oauth2:***@#g'; then + echo "SCHREIBEN OK: Zweig $REF angelegt." + else + echo "SCHREIBEN FEHLGESCHLAGEN - Rolle oder Scope reichen nicht." + exit 1 + fi + git push "$URL" --delete "refs/heads/$REF" 2>&1 | sed 's#oauth2:[^@]*@#oauth2:***@#g' \ + && echo "Aufgeraeumt: $REF wieder entfernt." \ + || echo "WARNUNG: $REF blieb liegen, bitte von Hand loeschen."