GitLab CI ingest (no OAuth)
Send GitLab CI failures to Exlogare via after_script — no GitLab admin OAuth required.
If you’re on a self-hosted GitLab where you can’t install Exlogare’s OAuth app — or you just want to evaluate the tool on one repo first — you can drop a single after_script block into your .gitlab-ci.yml and curl the failure log to our generic ingest endpoint.
Required GitLab CI variable
Define EXLOGARE_TOKEN as a masked, protected CI/CD variable at the project or group level (Settings → CI/CD → Variables). Token needs the ingest scope.
Pipeline configuration
# .gitlab-ci.yml
.exlogare-after: &exlogare-after
after_script:
- |
if [ "$CI_JOB_STATUS" = "failed" ]; then
# ``after_script`` runs in a fresh shell — bring the previous
# step's stdout in via tee in the main script section.
curl -fsS -X POST https://api.exlogare.net/api/ingest/log \
-H "Authorization: Bearer $EXLOGARE_TOKEN" \
-H "Content-Type: application/json" \
-d "$(jq -n \
--arg pid "$CI_PIPELINE_ID" \
--arg jid "$CI_JOB_ID" \
--arg jn "$CI_JOB_NAME" \
--arg br "$CI_COMMIT_REF_NAME" \
--arg sha "$CI_COMMIT_SHA" \
--arg url "$CI_PIPELINE_URL" \
--arg log "$(cat build.log)" \
'{provider:"gitlab_ci", project:"$CI_PROJECT_PATH", pipeline_id:$pid, job_id:$jid, job_name:$jn, status:"failed", branch:$br, commit_sha:$sha, pipeline_url:$url, log:$log}')"
fi
stages: [test]
test:
stage: test
image: python:3.12-slim
before_script:
- apt-get update && apt-get install -y curl jq
script:
- set -o pipefail
- pytest -q 2>&1 | tee build.log
<<: *exlogare-after
The YAML anchor (&exlogare-after / <<: *exlogare-after) lets you reuse the block across many jobs without copy-pasting.
Why not the OAuth integration?
If you have admin rights on the GitLab instance, the OAuth integration is strictly better — Exlogare auto-discovers projects, posts RCAs as MR comments, and handles the hybrid webhook+polling mode for ephemeral runners. Use the ingest API only when OAuth isn’t an option.
Tips
after_scriptalways runs, even on success — theif [ "$CI_JOB_STATUS" = "failed" ]guard is what makes the call only on failure.- Cache
curlandjqin your base Docker image to avoid the apt step on every run. - For long jobs, write the log incrementally to disk:
pytest -q 2>&1 | tee build.log(line-buffered).