Skip to content
🎉 Launch sale:50% off everything over $22 — automatically applied at checkout· ends Aug 2Shop the sale →
DevOps AI ToolKit
Newsletter
All prompts
AI for GitLab CI/CD Difficulty: Beginner ClaudeChatGPT

GitLab CI/CD Coverage Cobertura MR Visualization Prompt

Wire test coverage so GitLab shows per-line coverage annotations directly in merge request diffs and a coverage percentage badge — using coverage_report Cobertura artifacts and the coverage regex, instead of coverage data that never surfaces in the MR.

Target user
Developers wiring coverage visibility into GitLab merge requests
Difficulty
Beginner
Tools
Claude, ChatGPT

The prompt

You are a senior CI/CD engineer who has wired test coverage into GitLab merge requests so reviewers see covered and uncovered lines right in the diff.

I will provide:
- My test job and how it currently produces coverage (lcov, Cobertura, JaCoCo, coverage.py, etc.)
- My language/framework and whether coverage shows up in the MR today
- The symptom (no badge, no diff annotations, or "0%" reported)

Your job:

1. **Two separate features** — explain the difference between the coverage percentage (parsed from job log via the `coverage:` regex) and the per-line MR diff annotations (parsed from a `artifacts:reports:coverage_report` Cobertura file). They are wired independently and people conflate them.

2. **Generate Cobertura** — show the tool/flags for my stack to emit a Cobertura XML report, including converting from lcov where needed.

3. **Wire the job** — produce the `.gitlab-ci.yml` test job with `coverage:` regex and `artifacts:reports:coverage_report:` with `coverage_format: cobertura` and the correct `path`.

4. **Path gotchas** — fix the most common cause of missing annotations: source paths in the Cobertura file not matching the repo paths GitLab expects.

5. **MR pipeline requirement** — explain why diff annotations require a merge-request pipeline and how `rules:` must allow it.

6. **Verify** — how to confirm the badge and the diff annotations actually render on a test MR.

Output as: (a) the coverage report-generation command, (b) the full `.gitlab-ci.yml` job, (c) a path-mismatch fix snippet, (d) a verification checklist.

If annotations do not appear, suspect the source-path mapping before anything else.

Run this prompt with AI

Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.

Related prompts

More GitLab CI/CD prompts & error guides

Browse every GitLab CI/CD prompt and troubleshooting guide in one place.

Free download · 368-page PDF

Reading prompts? Get all 500 in one free PDF

500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.

  • 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
  • Instant PDF download — yours free, forever
  • Plus one practical AI-workflow email a week (no spam)

Single opt-in · unsubscribe anytime · no spam.