Add AI-enhanced webhook mode for intelligent pipeline analysis
-
Please check this box if this contribution uses AI-generated content (including content generated by GitLab Duo features) as outlined in the GitLab DCO & CLA. As a benefit of being a GitLab Community Contributor, you receive complimentary access to GitLab Duo.
What does this MR do?
This MR introduces AI-enhanced webhooks that provide additional data in webhook payloads specifically designed for AI-powered CI/CD analysis tools. This enhancement was inspired by the development of AI Pipeline Guardian for the Google Cloud + GitLab Hackathon 2025.
Key Features
-
🤖 AI Analysis Mode: New webhook configuration option to enable enhanced payloads -
📊 Failed Job Logs: Include logs from failed jobs directly in the webhook payload -
🔍 Code Context: Add information about recent commits and modified files -
📈 Error Summary: Automated categorization of error types for AI tools -
🔒 Security: Respects existing permissions and variable masking
Why is this needed?
With the rise of AI-powered DevOps tools, webhooks need to provide richer context for intelligent analysis. Current webhooks only provide basic pipeline status, requiring tools to make multiple API calls to gather necessary data for analysis.
This enhancement enables:
- Immediate AI analysis without additional API calls
- Reduced latency for automated remediation
- Better error pattern recognition
- More efficient CI/CD failure resolution
Implementation Details
-
Database Changes: Added 4 new columns to
web_hookstable -
Backend Logic: Enhanced
WebHook#executeto include additional data when AI mode is enabled - Tests: To be added in follow-up commit
- UI: To be implemented in follow-up MR
Example Enhanced Payload
{
"object_kind": "pipeline",
"object_attributes": { "status": "failed" },
"failed_jobs_logs": [
{
"job_id": 12345,
"job_name": "test",
"stage": "test",
"failure_reason": "script_failure",
"logs": "last 500 lines of job output..."
}
],
"code_context": {
"recent_commits": [...],
"modified_files": ["app/models/user.rb"],
"branch_info": {...}
},
"ai_metadata": {
"timestamp": "2025-05-26T10:00:00Z",
"gitlab_version": "16.12.0",
"error_summary": {
"syntax_errors": 0,
"dependency_errors": 1,
"test_failures": 2
}
}
}
Performance Impact
- Webhook payload size increases only when AI mode is explicitly enabled
- Log inclusion is limited by configurable
log_lines_limit - No impact on existing webhooks without AI mode enabled
Testing
-
Unit tests (to be added) -
Integration tests (to be added) -
Performance tests (to be added)
Hackathon Context
This contribution was developed as part of the Google Cloud + GitLab Hackathon 2025, where we built AI Pipeline Guardian - an AI-powered tool that monitors GitLab pipelines and automatically fixes common failures. This MR makes such tools more efficient by providing the data they need directly in the webhook.
The hackathon challenged us to integrate AI into DevOps workflows, and we identified webhook enhancement as a key improvement that would benefit the entire GitLab ecosystem.
Related Links
- AI Pipeline Guardian - The tool that inspired this feature
- Closes #545822
Checklist
-
I have read the contribution guidelines -
Changelog entry added -
Tests added (follow-up) -
Documentation updated (follow-up) -
UI implementation (follow-up MR)
/cc @gitlab-org/pipeline-authoring @gitlab-org/integrations