Skip to content

A Jenkins plugin that provides an intelligent conversational interface for Jenkins operations. Chat with AI to manage builds, deployments, and system operations through natural language, all while respecting your Jenkins permissions.

License

Notifications You must be signed in to change notification settings

avisangle/jenkins-chatbot-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

16 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Jenkins AI Chatbot

Intelligent Conversational Interface for Jenkins Automation

Transform your Jenkins experience with AI-powered natural language interactions. This project provides a complete solution combining a Jenkins plugin with an intelligent AI service to enable conversational Jenkins management.

Jenkins Plugin AI Service License Java Python

πŸš€ What is Jenkins AI Chatbot?

Instead of navigating through Jenkins UI, simply ask:

  • "Trigger the frontend build with staging environment"
  • "What's the status of my latest deployment?"
  • "Show me the logs for the failed build"
  • "List all jobs I have access to"

The AI understands your intent, validates your permissions, and executes Jenkins operations on your behalf.

✨ Key Features

πŸ€– LLM-First Intelligence

  • Google Gemini Integration: Advanced natural language understanding
  • 21 Specialized Tools: Complete Jenkins API coverage through MCP tools
  • Multi-Step Operations: Handle complex workflows automatically
  • Context Awareness: Remember conversation history and user preferences

πŸ” Security & Permissions

  • Delegated Authorization: AI acts with your exact Jenkins permissions
  • Session Management: Secure 15-minute sessions with automatic cleanup
  • Audit Trail: Complete logging of all AI interactions
  • CSRF Protection: Full Jenkins security compliance

🎯 User Experience

  • Natural Language: No learning command syntax or complex UIs
  • Modern Chat Interface: Clean, responsive design integrated with Jenkins
  • Real-time Feedback: Instant responses with visual status indicators
  • Mobile Friendly: Works seamlessly on all devices

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Jenkins UI    β”‚    β”‚  Jenkins Plugin  β”‚    β”‚   AI Agent Service  β”‚
β”‚                 │───▢│                  │───▢│                     β”‚
β”‚ β€’ Chat Interfaceβ”‚    β”‚ β€’ Session Mgmt   β”‚    β”‚ β€’ Google Gemini     β”‚
β”‚ β€’ Sidebar Link  β”‚    β”‚ β€’ Security       β”‚    β”‚ β€’ 21 MCP Tools      β”‚
β”‚ β€’ Permissions   β”‚    β”‚ β€’ REST API       β”‚    β”‚ β€’ Redis + PostgreSQLβ”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Components

  • Jenkins Plugin - Java-based plugin providing UI integration and session management
  • AI Agent Service - Python FastAPI service with Google Gemini and 21 MCP tools
  • Infrastructure - Redis for sessions, PostgreSQL for audit logging

πŸ“¦ Quick Start

Prerequisites

  • Jenkins: 2.462.3+
  • Java: 11+
  • Docker & Docker Compose: For AI service
  • Google Gemini API Key: For AI functionality

1. Install Jenkins Plugin

# Option A: Build from source
cd jenkins-plugin
mvn clean package
# Upload target/jenkins-chatbot.hpi to Jenkins β†’ Manage Plugins β†’ Advanced

# Option B: Download from Jenkins Update Center (coming soon)

2. Deploy AI Agent Service

# Configure environment
cp ai-agent/.env.example ai-agent/.env
# Edit .env with your GEMINI_API_KEY

# Start services
docker-compose up -d

# Verify services are running
curl http://localhost:8000/health

3. Configure Jenkins

  1. Go to Manage Jenkins β†’ Configure System
  2. Find "AI Chatbot Configuration" section
  3. Set AI Agent URL: http://localhost:8000
  4. Test connection (should show "Connection successful")
  5. Grant permissions: AI Chatbot β†’ Use (to appropriate users)

4. Start Chatting!

  1. Look for "AI Assistant" in Jenkins sidebar
  2. Click to open the chat interface
  3. Try asking: "What jobs do I have access to?"

πŸ’¬ Example Conversations

Build Management

πŸ‘€ User: "Trigger the frontend build"
πŸ€– AI: "I'll trigger the frontend build for you. Starting build #47 now."
   [βœ… Build #47 started successfully]

πŸ‘€ User: "What's the status?"
πŸ€– AI: "Build #47 is currently running. Started 2 minutes ago, estimated completion in 3 minutes."

Status Monitoring

πŸ‘€ User: "Show me recent failed builds"
πŸ€– AI: "Here are your recent failed builds:
   β€’ backend-service #23 - Failed 2 hours ago (test failures)
   β€’ integration-tests #15 - Failed yesterday (timeout)
   
   Would you like me to show the logs for any of these?"

Log Analysis

πŸ‘€ User: "Show me the log for backend-service #23"
πŸ€– AI: "Here are the key log entries from build #23:
   [ERROR] Tests failed: 3 out of 127 test cases
   [ERROR] DatabaseConnectionTest.testConnection - Connection timeout
   
   The build failed due to database connectivity issues during testing."

πŸ”§ Configuration

AI Agent Service Configuration

# ai-agent/.env
GEMINI_API_KEY=your-google-gemini-api-key
JENKINS_URL=http://your-jenkins-instance:8080
REDIS_URL=redis://localhost:6379/0
DATABASE_URL=postgresql+asyncpg://user:pass@localhost:5432/db
SECRET_KEY=your-secret-key-change-in-production

Jenkins Plugin Configuration

Global Settings (Manage Jenkins β†’ Configure System):

  • AI Agent URL: URL of the AI service (default: http://localhost:8000)
  • Session Timeout: How long sessions remain active (default: 15 minutes)
  • Enable Chatbot: Master on/off switch for the entire system

User Permissions:

  • AI Chatbot/Use: Basic access to chat interface
  • Standard Jenkins permissions: Required for actual operations (Job/Build, Job/Read, etc.)

πŸ› οΈ Development

Building from Source

Jenkins Plugin:

cd jenkins-plugin
mvn clean package
# Creates: target/jenkins-chatbot.hpi

AI Agent Service:

cd ai-agent
docker build -t jenkins-chatbot-ai-agent .

Full Development Environment:

# Start infrastructure
docker-compose up -d redis postgres

# Start AI service in development mode
cd ai-agent && ./scripts/start_dev.sh

# Start Jenkins with plugin
cd jenkins-plugin && mvn hpi:run

Testing

# Test AI Agent Service
python ai-agent/scripts/test_api.py

# Test Jenkins Plugin
cd jenkins-plugin && mvn test

# Test end-to-end integration
JENKINS_API_TOKEN="your-token" ./scripts/test_end_to_end.sh

πŸ›‘οΈ Security

Permission Model

  • Principle of Least Privilege: AI only has permissions you grant it
  • Session-Based Security: 15-minute secure sessions with automatic cleanup
  • Audit Logging: All interactions logged with user context and actions taken
  • No Elevated Access: AI cannot perform actions you don't have permission for

Best Practices

  • Secure API Keys: Keep Google Gemini API key secure and rotated
  • Network Security: Run AI service in trusted network environment
  • User Training: Educate users on appropriate AI assistant usage
  • Regular Audits: Review AI interaction logs for unusual patterns

πŸ“Š Monitoring

Health Checks

# AI Agent Service
curl http://localhost:8000/health

# Jenkins Plugin
http://your-jenkins/ai-assistant/health

Logging

  • Jenkins Plugin: Standard Jenkins logs ($JENKINS_HOME/logs/)
  • AI Agent Service: Structured JSON logs via Docker Compose
  • Audit Trail: PostgreSQL database with full interaction history

Metrics (Optional)

# Enable monitoring stack
docker-compose --profile monitoring up -d

# Access dashboards
# Prometheus: http://localhost:9090
# Grafana: http://localhost:3000

πŸ” Troubleshooting

Common Issues

1. "AI Assistant" not visible in sidebar

  • Check user has "AI Chatbot/Use" permission
  • Verify plugin is installed and enabled
  • Confirm user has "Overall/Read" permission

2. Connection failed to AI service

  • Verify AI service is running: curl http://localhost:8000/health
  • Check firewall and network connectivity
  • Validate AI Agent URL in Jenkins configuration

3. Permission denied errors

  • User lacks required Jenkins permissions for the requested action
  • Check Jenkins security matrix for appropriate permissions
  • Review audit logs for specific permission failures

4. AI responses seem incorrect

  • Check Google Gemini API key and quotas
  • Verify MCP tools are functioning: curl http://localhost:8010/health
  • Review conversation context and session state

For detailed troubleshooting guides, see:

πŸ“š Documentation

Core Documentation

API References

🀝 Contributing

We welcome contributions! Here's how to get started:

Getting Started

  1. Fork the repository
  2. Set up development environment (see Development section above)
  3. Create feature branch: git checkout -b feature/amazing-feature
  4. Make your changes with tests
  5. Submit pull request with detailed description

Development Areas

  • Jenkins Plugin: Java development, UI improvements, security enhancements
  • AI Agent: Python/FastAPI, LLM integration, tool development
  • Documentation: User guides, API docs, troubleshooting
  • Testing: Unit tests, integration tests, user acceptance testing

Code Standards

  • Follow existing code style and patterns
  • Include comprehensive tests for new functionality
  • Update documentation for user-facing changes
  • Ensure security best practices are followed

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

🌟 Acknowledgments

  • Jenkins Community - For the amazing automation platform
  • Google AI - For Gemini API and language model capabilities
  • MCP Protocol - For standardized tool integration
  • FastAPI Community - For the excellent async web framework

πŸ“ž Support

  • πŸ› Bug Reports: GitHub Issues
  • πŸ’‘ Feature Requests: GitHub Discussions
  • πŸ“– Documentation: Check the docs/ directory for detailed guides
  • πŸ’¬ Community: Join discussions in GitHub Issues and Discussions

Transform your Jenkins workflow with AI β€’ Natural Language Operations β€’ Secure & Permission-Aware β€’ Production Ready

Made with ❀️ for the Jenkins community

About

A Jenkins plugin that provides an intelligent conversational interface for Jenkins operations. Chat with AI to manage builds, deployments, and system operations through natural language, all while respecting your Jenkins permissions.

Resources

License

Stars

Watchers

Forks

Packages

No packages published