Home / Documentation / CI/CD Integration

CI/CD Integration

TraceLoom automatically detects CI environments and adapts its output. Use environment variable auth to avoid interactive prompts, and rely on exit codes to fail your pipeline on test failures.

Auto-detection

TraceLoom detects non-TTY environments (CI pipelines) automatically and switches to plain text output without spinners. No configuration required — it just works.

Authentication in CI

Rather than running traceloom auth in your pipeline, set the TRACELOOM_API_KEY environment variable. This takes precedence over the credentials file:

export TRACELOOM_API_KEY=tlk_your_api_key_here

Store your API key as a secret in your CI provider (e.g., a GitHub Actions secret named TRACELOOM_API_KEY) and inject it into the environment at runtime. Never hardcode API keys in your workflow files.

GitHub Actions Example

name: Tests
on: [push]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: actions/setup-node@v4
        with:
          node-version: 20

      - run: npm ci

      - name: Run TraceLoom tests
        env:
          TRACELOOM_API_KEY: ${{ secrets.TRACELOOM_API_KEY }}
        run: npx traceloom run

Exit Codes for CI Pass/Fail

traceloom run exits with a meaningful code you can use to fail your pipeline:

Code Meaning CI behavior
0 All tests passed Pipeline continues / succeeds
1 One or more tests failed Pipeline fails
2 Error (API failure, timeout, missing config) Pipeline fails

Most CI providers (including GitHub Actions) treat any non-zero exit code as a failure, so you get automatic pass/fail behavior with no extra configuration.

Tips

  • No spinners in CI: TraceLoom switches to plain text output automatically when it detects a non-TTY environment. Logs are clean and parseable.
  • Store as a secret: Add TRACELOOM_API_KEY as a secret in your CI provider's secrets manager — never commit it to source control.
  • Use npx: You can use npx traceloom run without a global install, which avoids version pinning issues across machines.

Next Steps

Last updated: April 2026

>