Inspiration
As someone working with code collaboration platforms, we often found manual code reviews time-consuming, inconsistent, and prone to oversight. With the rise of generative AI models like Google Gemini and the power of GitLab CI/CD automation, we saw an opportunity to streamline the review process using AI. The idea was to create a plug-and-play GitLab CI/CD component that could automatically review code in merge requests, provide constructive feedback, and help teams maintain quality at scale.
What it does
The AI Code Reviewer is a plug-and-play GitLab CI/CD component that automatically reviews code changes in merge requests using Google Gemini via Vertex AI. It fetches the code diffs from GitLab, sends them to the LLM, and posts review comments directly back to the merge request—just like a human reviewer would. This tool helps development teams maintain code quality, reduce review bottlenecks, and catch potential issues early.
How we built it
Core Components:
- gitlab.py: Fetches merge requests and file diffs.
- llm.py: Sends diff context to Gemini and receives suggestions.
- review.py: Coordinates the logic between GitLab API and Gemini, formats and posts review.
- code-review.yml: CI/CD config that triggers the review job on MRs. Authentication:
- Uses GitLab Personal Access Token to access repos securely.
- Uses a Google Service Account key to connect with Vertex AI.
- CI/CD Integration: Set up as a GitLab CI/CD Catalog Component, so users can include it in any project with minimal config. ## Challenges we ran into
- Making the LLM feedback clear and actionable, not vague or overly verbose.
- Creating a generic, reusable CI/CD component that works across different types of repositories and projects.
- Debugging YAML errors in GitLab CI/CD and aligning pipeline behavior with merge request events.
- Publishing our first version of project on Gitlab and making it available for CI/CD catalog ## Accomplishments that we're proud of
- Built a working AI-powered code reviewer that's easy to plug into any GitLab project.
- Successfully integrated Vertex AI's Gemini model for contextual and helpful code suggestions.
- Packaged it as a reusable GitLab CI/CD Catalog component, making it developer-friendly. ## What we learned
- How to integrate third-party APIs like Gemini into CI/CD pipelines.
- How to structure and publish GitLab CI/CD Catalog components.
- How to use the GitLab API to automate MR workflows.
- Practical considerations of using LLMs in production, like token context limits and feedback control.
- Best practices for keeping CI/CD secrets and service accounts secure. ## What's next for AI code Reviewer
- Support inline comments in merge requests (instead of summary comments).
- Allow configuration for review style (e.g., strict, beginner-friendly, security-focused).
- Add support for other LLMs (OpenAI, Claude) via environment config.
- Extend to other platforms like GitHub Actions or Bitbucket Pipelines.
- Build a web UI dashboard to show review history, suggestions, and code quality metrics over time.
Built With
- ci/cd
- gitlab
- python
- rest
- vertex
Log in or sign up for Devpost to join the conversation.