Inspiration
Modern CI/CD pipelines are the backbone of software delivery, but they are often bloated, sequential, and lack dependency caching. This "configuration drift" wastes millions of hours of expensive compute minutes globally and unnecessarily inflates the digital carbon footprint of software engineering. We were inspired by the emerging field of GreenOps—the practice of minimizing the environmental impact of IT operations—to build an AI agent that automatically polishes pipelines to save both money and the planet.
What it does
EcoOps Test Optimiser is an autonomous GitLab Duo Agent that acts as an intelligent Code Reviewer. When a developer opens a Merge Request, the EcoOps Flow is triggered. The Agent dynamically reads the repository's .gitlab-ci.yml file, analyzes it for inefficiencies (such as missing NPM caches, sequential execution bottlenecks, or heavy Docker images), and instantly posts a 🌱 EcoOps Carbon Impact Report directly into the Merge Request comments.
Crucially, it generates the fully optimized, parallelized YAML code inside a red/green syntax-highlighted diff block, allowing the developer to instantly visualize the changes and apply the fixes.
How we built it
We built the entire ecosystem using the innovative GitLab Duo Agent Platform.
- The Agent (agent.yml): We prompt-engineered the agent with a GreenOps DevOps persona. We equipped it with GitLab's
read_filetools so it can autonomously inspect the repository's CI configuration without requiring the user to paste code. - The Flow (flow.yml): We mapped the agent to GitLab's built-in
Mention,Assign, andAssign Reviewertriggers to seamlessly integrate it into standard SDLC operations. - The Automation: To make our solution "Zero-Touch" without relying on experimental pipeline triggers, we wrote a lightweight script into our standard .gitlab-ci.yml. When an MR is opened, the script automatically assigns the AI's Service Account as a reviewer. This elegantly chains classic CI/CD automation straight into the Duo AI Flow!
Challenges we ran into
Our biggest challenge was ensuring the agent didn't "hallucinate" over-optimizations or ruthlessly strip out necessary custom shell scripts. For example, our pipeline relies on a custom trigger-ecoops-agent job to automate its own reviewer assignment. The AI initially wanted to optimize it out of existence!
To solve this, we implemented Interactive Architecture Permissions. We engineered the system prompt in the YAML to explicitly detect the trigger text, preserve it, and intelligently ask the developer in the report: "An autonomous AI trigger was detected. Let me know if you want me to remove it or keep it." This created a highly cohesive, collaborative loop between human and AI rather than a destructive one.
What's next for EcoOps Test Optimiser
We plan to upgrade the agent's platform toolset by giving it the highly privileged create_commit and create_merge_request capabilities. This will allow it to autonomously branch, fix, and submit nested Merge Requests across thousands of legacy enterprise repositories simultaneously, driving down global data center emissions one pipeline at a time.
Built With
- automation
- gitlab-duo
- markdown
- yaml
Log in or sign up for Devpost to join the conversation.