Skip to main content

CI/CD Integration

Integrate Sentry CLI into your CI/CD pipelines to automate issue tracking, debugging, and deployment workflows.

Authentication

All CI/CD environments require authentication via the SENTRY_AUTH_TOKEN environment variable.

Creating an Auth Token

1

Create a Sentry Auth Token

Go to Settings → Account → API → Auth Tokens in Sentry and create a new token with the appropriate scopes:
  • org:read - View organizations and projects
  • project:read - View project details
  • event:read - View issues and events
  • event:write - Update issue status (optional)
2

Store as Secret

Add the token to your CI/CD platform’s secret management:
  • GitHub Actions: Repository Settings → Secrets → Actions
  • GitLab CI: Settings → CI/CD → Variables
  • Jenkins: Credentials → Add Credentials
  • CircleCI: Project Settings → Environment Variables
Never commit SENTRY_AUTH_TOKEN to your repository. Always use your CI platform’s secret management.

GitHub Actions

Basic Workflow

Integrate Sentry CLI into GitHub Actions to check issues, run queries, and automate debugging.
.github/workflows/sentry.yml

Multi-Project Monitoring

Monitor multiple projects in a single workflow:
.github/workflows/sentry-multi.yml

Advanced: AI-Powered Issue Analysis

Use Sentry’s AI (Seer) to get automated root cause analysis:
.github/workflows/sentry-ai.yml

GitLab CI

Basic Pipeline

.gitlab-ci.yml

Multi-Environment Monitoring

.gitlab-ci.yml

Jenkins

Declarative Pipeline

Jenkinsfile

Scripted Pipeline with Error Handling

Jenkinsfile

CircleCI

Configuration

.circleci/config.yml

Environment Variables

Required Variables

Optional Variables

Setting Variables

Best Practices

1. Use JSON Output for Parsing

Always use --json flag when processing output in scripts:

2. Handle Rate Limits

Add retry logic for API rate limits:

3. Cache CLI Binary

Cache the Sentry CLI binary to speed up builds:

4. Set Build Status

Fail builds based on issue severity:

5. Scheduled Monitoring

Set up scheduled jobs to monitor issue trends:

Troubleshooting

Authentication Failures

If authentication fails, verify:
  1. Token has correct scopes in Sentry
  2. Environment variable is set correctly
  3. Token hasn’t expired

Command Not Found

Ensure CLI is in PATH:

API Rate Limits

If you hit rate limits, reduce polling frequency or use pagination:

Next Steps

Scripting Guide

Build automation scripts with JSON output

AI Agents

Integrate with AI coding assistants