Name: Greenlight: hands-off, carbon-aware delivery Inspiration AI agents made writing code cheap, so the cost moved to everything after the code. An agent that iterates on an MR triggers the full pipeline every push, on whatever grid, at whatever hour. That's real energy, and nobody measures it per change, so nobody can improve it. What it does You open an issue and assign it to Greenlight. Duo agents triage it, implement it, review it for security and energy hotspots, and open an MR. The pipeline's carbon gate reads live grid intensity and the diff, then generates a right-sized child pipeline: only impacted tests when the grid is dirty, deferring the full suite to a nightly green window. SAST and secret detection always run. Any failure summons a Fixer flow that pushes a fix. On green, the MR auto-merges, builds the site once, smoke-tests that exact artifact as staging, and publishes it to GitLab Pages; production is verified to serve the new commit, or the change is reverted automatically. Last, a Software Carbon Intensity receipt lands on the original issue: grams of CO₂e for the change, and how much was avoided. When the incoming code is dangerous, Greenlight heals it. In merge request !2 (merged) we pushed a command-injection bug: SAST flagged it, the security gate blocked the merge, the pipeline summoned the Fixer flow, which removed the shell call and validated input, and the fixed change re-verified, auto-merged and deployed in 7 minutes with no human involved. A nightly probe opens an incident issue if production breaks, and the Autopilot picks that up too. How we built it

GitLab Duo Agent Platform: two custom flows (Autopilot: 4 agents; Fixer: 2 agents) and AGENTS.md rules. GitLab CI/CD: dynamic child pipelines, SAST, secret detection, dependency scanning, a custom security gate, merge-when-pipeline-succeeds, environments, dotenv artifacts, schedules. GitLab Pages: static production site (zero compute per visit), version-verified deploys, revert-based rollback. SCI (Green Software Foundation, ISO/IEC 21031) with Cloud Carbon Footprint coefficients and Electricity Maps live intensity.

Sustainability, quantified SCI = ((E × I) + M) per R, R = one change shipped to production. E comes from real job durations in the GitLab API across every pipeline of the MR. On the two changes Greenlight shipped autonomously (merge requests !1 (merged) and !2 (merged)), CI carbon per change was 48–49 % lower than a run-everything pipeline, and production is a static site with no always-on server. Scaled to a 1,000-developer org (5 changes per developer per week), that's ≈31,300 CI hours, ≈279 kWh, ≈190 kg CO₂e and ≈$18,800 avoided per year. Receipts embed their raw numbers so anyone can recompute them. Challenges Making carbon-awareness safe: production never ships on a partial run, and security is never skipped. Measuring honestly: every number on a receipt can be recomputed from the receipt. What's next Forecast-based scheduling (wait for the green hour instead of the nightly window), per-team carbon budgets enforced as an MR approval rule, and runner-region selection.

Built With

  • electricity-maps
  • gitlab
  • gitlab-ci
  • gitlab-duo
  • gitlab-pages
  • green-software
  • python
  • sast
  • semgrep
Share this project:

Updates