Skip to content

GiteaPushMirrorFailing

Severity: warning. Fires when the CronJob gitea/github-push-mirror has not completed successfully for 50 minutes, or not since it was created. It runs every 15 minutes and fails when the push it triggers after recreating a failed mirror fails too (a failed push that the new push repairs ends the run Complete), so this means at least three runs in a row failed. Nothing breaks at once, but the GitHub repository behind Flux's bootstrap-cluster GitRepository goes stale, and a Gitea outage would then leave Flux without a current fallback source. This was the 2026-10-20 case (#1375).

Labels: namespace: gitea, cronjob: github-push-mirror.

The reconciler and its two credentials are described on the Flux page: a Gitea access token for the Gitea API, and a GitHub token that Gitea uses for the push. Both come from OpenBao clusters/hetzner-mgmt/gitea/github-mirror through the ExternalSecret gitea/github-mirror-token.

Read-only checks

# Which credential fails: the reconciler's log
kubectl --context admin@mgmt-cluster -n gitea get jobs -l batch.kubernetes.io/cronjob-name=github-push-mirror --sort-by=.metadata.creationTimestamp
kubectl --context admin@mgmt-cluster -n gitea logs job/<latest github-push-mirror job>

# Is the secret synced, with both keys?
kubectl --context admin@mgmt-cluster -n gitea get externalsecret github-mirror-token
kubectl --context admin@mgmt-cluster -n gitea get secret github-mirror-token -o jsonpath='{.data}' | jq 'keys'

# Gitea's own view of the push: "Authentication failed for 'https://github.com/...'"
kubectl --context admin@mgmt-cluster -n gitea logs deploy/gitea --since=2h | grep -i -E 'mirror|github' | tail -20

Read the log by its first error:

  • Gitea unreachable (...) repeated for 14 minutes, then URLError: Gitea did not accept connections for the whole wait, so check kubectl --context admin@mgmt-cluster -n gitea get deploy gitea and its pods. A planned stop shorter than 14 minutes does not fail the run. The gitea-preupgrade gate's stop has taken up to 11.5 minutes; its Job's status.startTime and completionTime show whether the run fell in one.
  • HTTP Error 401 on GET .../push_mirrors: Gitea rejects the reconciler's gitea-token (revoked, expired, or its user was deleted). The reconciler only fails on a 401 while Gitea's /api/healthz passes; it retries a 401 that comes from a database outage for up to GITEA_WAIT_SECONDS. If the log shows Gitea not healthy (HTTP 401) lines first, the run hit that limit: check gitea-postgresql before the token. 403: the token lacks scope write:repository, or its user has no admin rights on Skatzi/platform.
  • removing push mirror ... last error: ... Authentication failed, then but its push failed: ... Authentication failed, on every run: GitHub rejects github-mirror-token (expired, revoked, or no longer Contents: read and write on the repository).
  • remote: Internal Server Error, (Internal Server Error) or another 5xx in the last error, even after [remote rejected]: GitHub failed on its side, not the token or branch protection. When the same run's re-push logs and pushed, last update ..., the error was transient: the run ends Complete and nothing needs to change. Only a 5xx that also shows in but its push failed: ... fails the run; when it repeats over several runs, check https://www.githubstatus.com and wait for GitHub to recover. The GitHub 500 incident is an example.
  • protected branch, GH006 or a ruleset message in the last error: a GitHub branch protection rule or ruleset blocks the force push; the bootstrap repository must not have one.
  • Pod not started, CreateContainerConfigError: a key of github-mirror-token is missing; see ExternalSecretNotReady.

Roll forward

An agent cannot create either token. Raise an attention item for the owner that names the failing credential and the step:

  • Gitea token: as an account with admin rights on Skatzi/platform, create an access token with scope write:repository and write it to property gitea-token. The Gitea backup gate uses the same token for its smoke check (ExternalSecret gitea-scratch/gitea-token), so a revoked token also fails the gate and the restore drill.
  • GitHub token: create a fine-grained token on DunkRing/bootstrap-cluster only, with Contents: read and write, and write it to property github-mirror-token.
  • Write with bao kv patch -mount=clusters hetzner-mgmt/gitea/github-mirror <property>=<token>, so the other property is kept, then sync at once: kubectl --context admin@mgmt-cluster -n gitea annotate externalsecret github-mirror-token force-sync=$(date +%s) --overwrite (after a new Gitea token, also kubectl --context admin@mgmt-cluster -n gitea-scratch annotate externalsecret gitea-token force-sync=$(date +%s) --overwrite).

The next run recreates the mirror with the new GitHub token and triggers a push; when that push works, the run ends Complete and logs and pushed, last update .... To run it now: kubectl --context admin@mgmt-cluster -n gitea create job --from=cronjob/github-push-mirror github-push-mirror-manual. Then check that git ls-remote of both repositories prints the same main SHA.

Roll back

Nothing to roll back: the reconciler only touches the push mirror to GitHub. If the failures started with a change to components/gitea/push-mirror/, revert that pull request.