Skip to content

πŸ€– An AI-powered DevOps agent implementing ReAct architecture to automate mobile release pipelines (Crash Check -> Perf -> Build -> Audit). Built with LangGraph & Ollama.

Notifications You must be signed in to change notification settings

ethanzhongch/CICD-Agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

13 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ Release Master Agent (CICD-Agent)

An AI-powered DevOps agent that automates the mobile release pipeline using ReAct architecture.

Status: 🚧 Under Development

English | δΈ­ζ–‡ζ–‡ζ‘£

πŸ“– Introduction

CICD-Agent is an intelligent release automation tool built with LangGraph and Python. It mimics the cognitive workflow of a Senior Release Manager, orchestrating real-world DevOps tools to ensure a high-quality mobile app release.

The agent handles the end-to-end decision-making process:

  • Real Build Execution: (Upgraded!) Triggers real Gradle tasks (assembleDebug/Release). Supports both Standard Android and Kotlin Multiplatform (KMP) project structures. Automatically locates and renames APK artifacts based on branches.
  • Pre-flight Checks (Mock): Verifies if fatal crashes are resolved via Bugly/Sentry simulation.
  • Static Security Analysis: Uses Androguard to parse the binary APK, verifying package integrity, SDK versions, Debug signatures, and detecting high-risk permissions.
  • Real Device Performance: Uses ADB to install the APK (with auto-grant permissions), performs a Cold Start (Force Stop -> Launch), and analyzes Memory Usage (PSS) in real-time.

πŸ—οΈ Architecture

The project implements the ReAct (Reasoning + Acting) pattern. The Agent serves as a central "Brain" that dynamically selects tools from a toolkit based on the current state and observation results.

graph LR
    subgraph AgentSystem ["πŸ€– The Agent System"]
        direction TB
        Memory[("🧠 Memory/Context")]
        Reasoning["⚑ Reasoning Engine (Brain)"]
        Memory <--> Reasoning
    end

    subgraph ToolKit ["πŸ› οΈ Tool Kit"]
        direction TB
        T_Build["1. πŸ”¨ Real Gradle Builder"]
        T_Crash["2. πŸ”Ž Crashlytics (Mock)"]
        T_Audit["3. πŸ›‘οΈ Static Analysis (Androguard)"]
        T_Perf["4. πŸ“± Real Device Test (ADB)"]
    end

    User("πŸ‘€ User Input") ==> Reasoning
    Reasoning -- "Action" --> ToolKit
    ToolKit -- "Observation" --> Reasoning
    Reasoning ==> FinalResult["πŸ“ Final Report"]
Loading

πŸ› οΈ Tech Stack

  • Core: Python 3.10+
  • Package Manager: uv (Ultra-fast Python package installer)
  • Orchestration: LangGraph (Stateful, multi-actor applications)
  • LLM Integration: LangChain + Ollama (Llama3 / Qwen)
  • Build System: Gradle (Android / KMP)
  • Static Analysis: Androguard (APK Reverse Engineering)
  • Mobile Bridge: Android Debug Bridge (ADB)

⚑ Quick Start

This project uses Ollama for local inference and uv for dependency management.

πŸ› οΈ Prerequisites

  1. Install uv (Package Manager):

    # macOS / Linux (via Homebrew)
    brew install uv
    
    # Or via Curl (Universal)
    # curl -LsSf https://astral.sh/uv/install.sh | sh
  2. Environment Setup (Crucial for Real Builds):

    • Java JDK: Version 11 or 17 installed (JAVA_HOME set).
    • Android SDK: Installed (ANDROID_HOME set).
    • ADB Tools: Ensure adb is in your PATH and an Android device/emulator is connected.
  3. LLM Setup:

    • Download Ollama.
    • Start server: ollama serve
    • Pull model: ollama pull qwen3:8b (Match llm_configs.py)

πŸš€ Installation & Run

  1. Clone the Repository:

    git clone https://github.com/ethanzhongch/CICD-Agent.git
    cd CICD-Agent
  2. Install Dependencies:

    uv sync
  3. Configure Target Project βš™οΈ: You do not need to provide an APK manually anymore. Point the agent to your Android source code instead.

    Edit src/cicd_assistant/main.py:

    # 1. Path to your Android/KMP Project Root (folder containing gradlew)
    android_project_root = "/path/to/your/project"
    
    # 2. App Details (Must match your AndroidManifest.xml and ADB output)
    # Tip: Run `adb shell dumpsys window | grep mCurrentFocus` to find these.
    target_package = "com.example.app"
    target_activity = ".MainActivity"
    
    # 3. Build Variant ("debug" is recommended for unsigned CI testing)
    target_variant = "debug"
  4. Connect Device: Ensure your device/emulator is connected and authorized:

    adb devices
  5. Run the Agent:

    uv run src/cicd_assistant/main.py

πŸ“ Output

The agent will perform the following steps automatically:

  1. Build the project from source and save the APK to src/fixtures/.
  2. Audit the generated APK.
  3. Install & Launch the APK on your real device (Cold Start).
  4. Generate Report at outputs/release_report.md.

❓ Troubleshooting

  • ADB Error: Device not found: Ensure your device is visible in adb devices.
  • Error type 3: Activity class does not exist: Double-check target_package and target_activity in main.py. The package name must match exactly what is installed on the phone.
  • Install Failed (No Certificates): Ensure target_variant is set to "debug". Release builds require signing configuration in build.gradle.

πŸ“„ License

MIT

About

πŸ€– An AI-powered DevOps agent implementing ReAct architecture to automate mobile release pipelines (Crash Check -> Perf -> Build -> Audit). Built with LangGraph & Ollama.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages