feat(ci): export job logs to loki, clean up pr artifacts #831
Inga granskare
Etiketter
Inga etiketter
area/backups
area/ci
area/control-panel
area/identity
area/infra
area/observability
area/payments
area/security
area/storage
area/web
blocked
needs-info
needs-triage
priority
high
priority
low
priority
medium
ready-for-implementation
type
bug
type
chore
type
docs
type
epic
type
feature
type
task
wontfix
Ingen milstolpe
Inget projekt
Inga tilldelade
1 deltagare
Notiser
Förfallodatum
Inget förfallodatum satt.
Beroenden
Inga beroenden satta
Referens
bitborg/bitborg-infra!831
Läser in…
Hänvisa till i nytt ärende
Ingen beskrivning angiven.
Ta bort grenen "feat/ci-logs-and-artifact-cleanup"
Borttagning av en gren är permanent. Även om den borttagna grenen kan fortsätta existera en kort tid innan den faktiskt tas bort, kan det INTE ångras i de flesta fall. Vill du fortsätta?
Closes #177
Closes #178
CI job-log export (#177)
ci-log-export: 10-minute timer, Python script. Walks org repos, lists finished runs and jobs, downloads each job log as NDJSON (GET /repos/{o}/{r}/actions/jobs/{id}/logs?format=ndjson), pushes to Loki.source,repo,workflow,ci_job,status. Run and job id are in the first log line, not labels.repo#job.attemptkeys. Window 120 h (Loki rejects samples older than 168 h).bitborg_ci_log_export_*, alertsCiLogExportFailedandCiLogExportStale.Artifact cleanup (#178)
artifact-cleanup: daily timer. Purges artifacts ofpull_request*runs older than 7 days. Tag, release, push and schedule artifacts are kept.ARTIFACT_RETENTION_DAYSstays the backstop.artifact_cleanup_delete_enabled: true.bitborg_artifact_cleanup_*, alertsArtifactCleanupFailedandArtifactCleanupStale.Tokens
Two new service accounts in
forgejo_service_accounts(non-admin, one token each). Token-audit derives its list from that variable, so it covers them.Operator steps
--tags forgejoto createbitborg-ci-logsandbitborg-artifact-cleanup.bitborg-ci-logsto a read team andbitborg-artifact-cleanupto a write team (Actions unit) of thebitborgorg.read:repository,read:organizationandwrite:repository,read:organization. Vault asvault_forgejo_ci_log_export_tokenandvault_forgejo_artifact_cleanup_token.--tags ci-log-export,artifact-cleanup,monitoring.{source="forgejo-actions"}.bitborg-artifact-cleanup, then setartifact_cleanup_delete_enabled: trueand apply.Tests
python3 ansible/roles/ci-log-export/files/test_ci_log_export.py,python3 ansible/roles/artifact-cleanup/files/test_artifact_cleanup.py, wired into CI.