Skip to content

Shrinidhi3012/CI-CD_Guardian_Bot

Repository files navigation

🤖 CI/CD Guardian Bot

An intelligent AI-powered bot that automatically analyzes CI/CD failures, provides root cause analysis, and takes corrective actions - saving developers hours of debugging time.

Python Docker Tests


🎯 The Problem

When CI/CD pipelines fail, developers waste 15-20 minutes per failure:

  • ❌ Manually checking logs (35,000+ characters)
  • ❌ Identifying error patterns
  • ❌ Determining if it's a flaky test or real bug
  • ❌ Deciding whether to retry or investigate
  • ❌ Creating tracking issues
  • ❌ Notifying the team

CI/CD Guardian automates all of this in 30 seconds.


✨ The Solution

CI/CD Guardian is a webhook-based bot that:

  1. 🔍 Detects workflow failures in real-time
  2. 📥 Downloads and parses logs automatically
  3. 🧠 Analyzes failures using AI (Mistral LLM)
  4. 🔄 Auto-retries flaky tests (up to 2 attempts)
  5. 📝 Creates GitHub issues for persistent bugs
  6. 💬 Notifies team via Discord with actionable insights
  7. 📊 Tracks metrics and performance

🚀 Impact

  • 85% faster failure triage (20 min → 3 min)
  • 70% automated retry handling for flaky tests
  • 100% coverage of all CI/CD failures
  • Real-time team notifications
  • Data-driven insights with metrics

🎬 Demo

Discord Notification

Discord Notification Real-time alerts with AI analysis and clickable links to logs

GitHub Comment

GitHub Comment Detailed failure analysis posted directly on commits

Metrics Dashboard

Metrics Dashboard Track performance and success rates in real-time

GitHub Issue Creation

GitHub Issue Automated issue creation with AI analysis and duplicate detection


🏗️ Architecture

System Workflow

graph TB
    A[⚠️ GitHub Workflow Fails] -->|Webhook HTTPS| B[🌐 CI/CD Guardian Bot<br/>Flask Server Port 5001]
    B -->|Fetch logs| C[📥 Download Logs<br/>ZIP ~35KB]
    C -->|Extract & parse| D[🔍 Parse Errors<br/>Regex patterns]
    D -->|Send context| E[🧠 AI Analysis<br/>Mistral 7B via Ollama<br/>~10s]
    E -->|Categorize| F{🔀 Failure Type?}
    
    F -->|Flaky Test/Timeout| G[🔄 Auto-Retry<br/>Max 2 attempts]
    F -->|Real Bug| H[📝 Create GitHub Issue<br/>Duplicate detection]
    
    G -->|Update status| I[💬 Discord Notification<br/>Real-time alert]
    H -->|Alert team| I
    
    I -->|Track performance| J[📊 Metrics Collector<br/>8+ KPIs]
    
    style A fill:#ffcdd2,stroke:#c62828,stroke-width:2px
    style B fill:#bbdefb,stroke:#1976d2,stroke-width:2px
    style C fill:#c8e6c9,stroke:#388e3c,stroke-width:2px
    style D fill:#fff9c4,stroke:#f57f17,stroke-width:2px
    style E fill:#e1bee7,stroke:#7b1fa2,stroke-width:3px
    style F fill:#ffe082,stroke:#f57c00,stroke-width:2px
    style G fill:#b2ebf2,stroke:#00838f,stroke-width:2px
    style H fill:#f8bbd0,stroke:#c2185b,stroke-width:2px
    style I fill:#c5cae9,stroke:#303f9f,stroke-width:2px
    style J fill:#b2dfdb,stroke:#00695c,stroke-width:2px
Loading

Tech Stack:

  • Backend: Python 3.13, Flask
  • AI: Ollama (Mistral 7B)
  • Integration: PyGithub, Discord Webhooks
  • Deployment: Docker, docker-compose
  • Monitoring: Custom metrics system
  • Testing: pytest (26 tests, 88% core coverage)

About

AI-powered self-healing CI/CD bot that automatically analyzes workflow failures, performs intelligent auto-retries, and creates tracked issues - reducing debugging time by 85%. Built with Python, Ollama (Mistral 7B), Docker, and Flask.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors