Skip to main content

CI/CD Troubleshooting Guide

Comprehensive troubleshooting guide for GitHub Actions workflows and CI/CD pipeline issues.

Table of Contents


Common Issues

1. Tests Failing in CI But Passing Locally

Symptoms:
  • Tests pass on local machine
  • Same tests fail in GitHub Actions
  • Error messages mention environment differences
Root Causes:
  • Environment variable differences
  • Timing/race conditions
  • Different Python versions
  • Missing dependencies
Solutions:
Prevention:
  • Use .env.example to document required variables
  • Run pre-commit hooks before pushing
  • Test with multiple Python versions locally: make test-all-pythons

2. Docker Build Failures

Symptoms:
  • docker build fails in CI
  • “No space left on device” errors
  • Network timeout errors
Root Causes:
  • Disk space exhaustion
  • Network timeouts
  • Cache issues
  • Base image unavailability
Solutions:
Additional Debug Steps:
Known Issue: GitHub-hosted runners have ~14GB free space. Our cleanup step addresses this.

3. Pre-commit Hooks Failing

Symptoms:
  • Pre-commit job fails in CI
  • Hooks pass locally but fail in CI
  • Formatting differences
Root Causes:
  • Different tool versions
  • Line ending differences (CRLF vs LF)
  • File not committed
Solutions:
Workaround: If hooks consistently fail, you can temporarily skip:

4. Deployment Authentication Failures

Symptoms:
  • “Permission denied” during GCP auth
  • “Workload Identity Provider not found”
  • “Invalid service account”
Root Causes:
  • Missing or incorrect GitHub secrets
  • Workload Identity misconfiguration
  • Service account lacks permissions
Solutions:
See Also: GCP Configuration Guide

Workflow-Specific Issues

Main CI/CD Pipeline (ci.yaml)

Issue: Test Job Timeout

Symptoms:
  • Job exceeds 30-minute timeout
  • Tests hang indefinitely
Solutions:

Issue: Docker Multi-platform Build Fails

Symptoms:
  • ARM64 build fails
  • “exec format error”
Solutions:

Security Scan Workflow (security-scan.yaml)

Issue: Trivy Scan Finds Vulnerabilities

Symptoms:
  • Security scan fails
  • Critical/High vulnerabilities reported
Solutions:

Issue: CodeQL Analysis Fails

Symptoms:
  • “No code found to analyze”
  • Python extraction errors
Solutions:

E2E Tests Workflow (e2e-tests.yaml)

Issue: Test Infrastructure Not Ready

Symptoms:
  • Tests fail with connection errors
  • “Service not healthy” messages
Solutions:

Coverage Tracking Workflow (coverage-trend.yaml)

Issue: Coverage Drops >5% Without Code Changes

Symptoms:
  • Coverage workflow fails
  • No obvious code changes
Root Causes:
  • New files added without tests
  • Conditional code not executed in CI
  • Test files excluded incorrectly
Solutions:

Performance Issues

Slow Workflow Runs

Symptoms:
  • CI takes >20 minutes
  • Jobs queued for long time
Diagnosis:
Optimizations:
  1. Improve Caching:
  1. Parallel Execution:
  1. Conditional Execution:
  1. Reduce Test Scope:

High GitHub Actions Costs

Symptoms:
  • Monthly bill exceeds budget
  • Many long-running workflows
Solutions:
  1. Monitor Costs:
  1. Optimize Workflows:
  1. Reduce Scheduled Runs:

Security Issues

Secrets Exposed in Logs

Symptoms:
  • Secrets visible in workflow logs
  • Security alerts from GitHub
Prevention:

Dependency Vulnerabilities

Symptoms:
  • Dependabot alerts
  • Security scan failures
Solutions:

Debugging Techniques

Enable Debug Logging

In Workflow File:
Via GitHub UI:
  1. Go to repository Settings → Secrets
  2. Add secret: ACTIONS_STEP_DEBUG = true
  3. Re-run workflow

SSH Into Runner (for Emergencies)

Using tmate:
⚠️ Warning: Remove tmate step before merging! It exposes your runner.

View Workflow Artifacts

Test Workflow Locally with Act


Getting Help

Where to Look

  1. Workflow Run Logs - Most detailed information
  2. GitHub Status - Check if GitHub Actions is down: https://www.githubstatus.com/
  3. Issue Tracker - Search existing issues: gh issue list
  4. Documentation - Workflow comments explain logic

Reporting Issues

When reporting CI/CD issues, include:
[Paste relevant log excerpt]

Emergency Contacts

  • CI/CD Issues: @cicd-team
  • Security Alerts: @security-team
  • Infrastructure: @platform-team

Useful Commands


Appendix: Workflow Quick Reference


Last Updated: 2025-11-02 Maintained By: CI/CD Team