Skip to content

Integrations

Ingest build records into Leliel from any CI system. All examples post to POST /api/v1/builds. Only four fields are required: build_id, repo, branch, status.


GitHub Actions

Add a step at the end of your workflow to ingest the build result:

# /─[ GitHub Actions — post-build ingest step ]─────────────────────────
# >  Posts build result to Leliel after every workflow job. Uses the
# >  built-in github context for all required fields. extra_data captures
# >  GitHub-specific metadata for later querying or LLM analysis.
- name: Ingest build result
  if: always()
  env:
    KNOWLEDGE_API_URL: ${{ secrets.KNOWLEDGE_API_URL }}
    KNOWLEDGE_API_KEY: ${{ secrets.KNOWLEDGE_API_KEY }}
  run: |
    STATUS="SUCCESS"
    if [ "${{ job.status }}" != "success" ]; then STATUS="FAILURE"; fi
    curl -sf -X POST "${KNOWLEDGE_API_URL}/api/v1/builds" \
      -H "Authorization: Bearer ${KNOWLEDGE_API_KEY}" \
      -H "Content-Type: application/json" \
      -d "{
        \"build_id\": \"${{ github.run_id }}\",
        \"repo\": \"${{ github.repository }}\",
        \"branch\": \"${{ github.ref_name }}\",
        \"status\": \"${STATUS}\",
        \"commit\": \"${{ github.sha }}\",
        \"extra_data\": {
          \"workflow\": \"${{ github.workflow }}\",
          \"actor\": \"${{ github.actor }}\",
          \"event\": \"${{ github.event_name }}\"
        }
      }"

Add these repository secrets:

Secret Value
KNOWLEDGE_API_URL Your Leliel base URL (e.g. http://your-host:8080)
KNOWLEDGE_API_KEY The KNOWLEDGE_API_KEY value from your Leliel .env

GitLab CI

Add a after_script section to your pipeline job or a dedicated ingest job:

# /─[ GitLab CI — post-build ingest job ]────────────────────────────────
# >  Runs after every pipeline regardless of outcome via needs and rules.
# >  Uses GitLab predefined variables for all required fields. Sends
# >  pipeline URL in extra_data for direct linking from the knowledge graph.
ingest-build:
  stage: .post
  image: curlimages/curl:latest
  when: always
  script:
    - |
      STATUS="SUCCESS"
      if [ "$CI_JOB_STATUS" != "success" ]; then STATUS="FAILURE"; fi
      curl -sf -X POST "${KNOWLEDGE_API_URL}/api/v1/builds" \
        -H "Authorization: Bearer ${KNOWLEDGE_API_KEY}" \
        -H "Content-Type: application/json" \
        -d "{
          \"build_id\": \"${CI_PIPELINE_ID}\",
          \"repo\": \"${CI_PROJECT_PATH}\",
          \"branch\": \"${CI_COMMIT_BRANCH}\",
          \"status\": \"${STATUS}\",
          \"commit\": \"${CI_COMMIT_SHA}\",
          \"extra_data\": {
            \"pipeline_url\": \"${CI_PIPELINE_URL}\",
            \"project_id\": \"${CI_PROJECT_ID}\"
          }
        }"

Set KNOWLEDGE_API_URL and KNOWLEDGE_API_KEY as CI/CD variables in your GitLab project settings.


curl (manual or scripted)

Minimal ingest with only required fields:

# /─[ curl — bare-minimum build ingest ]────────────────────────────────
# >  Posts the four required fields to ingest a build record. All other
# >  fields are optional and can be added as needed.
curl -X POST http://localhost:8080/api/v1/builds \
  -H "Authorization: Bearer your-pipeline-key" \
  -H "Content-Type: application/json" \
  -d '{
    "build_id": "my-build-001",
    "repo": "my-org/my-repo",
    "branch": "main",
    "status": "SUCCESS"
  }'

Full payload with all optional fields:

# /─[ curl — full build payload with all optional fields ]──────────────
# >  Demonstrates every accepted field. All fields except the four
# >  required ones are optional and can be omitted in any combination.
curl -X POST http://localhost:8080/api/v1/builds \
  -H "Authorization: Bearer your-pipeline-key" \
  -H "Content-Type: application/json" \
  -d '{
    "build_id": "my-build-002",
    "repo": "my-org/my-repo",
    "branch": "feature/my-feature",
    "status": "FAILURE",
    "commit": "abc123def456",
    "priority": "P2",
    "build_type": "pr",
    "change_id": "42",
    "duration_ms": 98000,
    "timestamp": "2026-05-06T12:00:00Z",
    "extra_data": {"ci_system": "my-ci", "trigger": "push"}
  }'

Python thin client

Install from the GitHub repository:

# /─[ pip install — Leliel thin client from GitHub ]────────────────────
# >  Installs only requests as a transitive dependency; no server-side
# >  FastAPI stack is pulled. Pin to a release tag for reproducible builds.
pip install git+https://github.com/rtsko/leliel.git@v2.0.0

After installing, import from leliel_client:

# /─[ Python thin client — ingest and query examples ]──────────────────
# >  LelielClient wraps the four most common API operations. pipeline_key
# >  authorises writes; user_key authorises reads. All HTTP errors are
# >  raised via raise_for_status() for the caller to handle.
from leliel_client import LelielClient

lc = LelielClient(
    base_url="http://localhost:8080",
    pipeline_key="your-pipeline-key",
    user_key="your-user-key",
)

# Ingest a build
lc.ingest_build({
    "build_id": "run-123",
    "repo": "my-org/my-repo",
    "branch": "main",
    "status": "SUCCESS",
    "commit": "deadbeef",
    "extra_data": {"workflow": "ci.yml"},
})

# Query builds for a repo
builds = lc.query_builds("my-org/my-repo", limit=10, status="FAILURE")

# Get analysis summary
analysis = lc.get_analysis("my-org/my-repo")

See client/README.md for the full API reference.