Skip to main content
Integrate AIRun into your CI/CD pipelines for automated testing, code analysis, documentation generation, and more.

Key Concepts for CI/CD

Permission Modes for Automation

CI/CD scripts need to run without interactive prompts. Use these permission modes:
--skip and --bypass give the AI full system access. In CI/CD:
  • Run inside containers for isolation
  • Use --allowedTools for security-critical pipelines
  • Never expose secrets in prompts
  • Review scripts before adding to CI

Provider Selection

CI/CD environments need API-based providers (not Claude Pro subscription):
Recommended for CI/CD: --apikey (Anthropic API) for simplicity.Just add ANTHROPIC_API_KEY to your CI secrets and use ai --apikey --skip.

Model Selection for Cost

GitHub Actions

Basic Test Analysis

Automated Code Review

Documentation Generation

Security Scanning

GitLab CI

Test Analysis Pipeline

Merge Request Review

CircleCI

Jenkins

Docker Container Patterns

Dockerfile for CI/CD

Usage:

Docker Compose for Local Testing

Cost Optimization

Choose the Right Model

Cache Setup Between Jobs

Limit Analysis Scope

Security Best Practices

1. Never Commit Secrets

Bad:
Good:

2. Use Allowed Tools in Production

Bad (unlimited access):
Good (limited access):

3. Isolate in Containers

4. Review Scripts Before CI

Test scripts locally before adding to CI:

Troubleshooting

Authentication Failures

Problem: “Authentication failed” in CI. Solution: Verify secret is set:

Rate Limits

Problem: Hitting API rate limits. Solutions:
  1. Use Haiku for simple tasks (higher rate limits)
  2. Add delays between requests
  3. Switch providers when hitting limits:

Timeout Issues

Problem: CI job times out. Solution: Add timeouts to AI commands:

Next Steps

Test Automation

Test analysis examples

Code Review

Automated review patterns

Security Guide

Security best practices

Provider Setup

Configure API providers