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
-
GitLab CI Artifact Dependency & Needs Cleanup Prompt
Untangle implicit artifact passing across stages and convert it to explicit needs:/dependencies: so jobs download only the artifacts they actually use.
-
GitLab CI/CD Code Coverage Integration Prompt
Configure code coverage parsing, MR coverage diff, trend graphs, badge integration, multi-language combined coverage.
-
GitLab Merge Request Pipeline Debug Prompt
Diagnose MR pipeline issues — pipeline not running, duplicate detached + branch pipelines, merge train failures, missing MR variables, ref:`merge` vs `head` SHA.
-
GitLab CI/CD Cache vs Artifacts Design Prompt
Choose between cache and artifacts in GitLab CI/CD — design cache keys that invalidate correctly, set artifact expiry, and avoid the common 'cache as artifact' mistake.
More GitLab CI/CD prompts & error guides
Browse every GitLab CI/CD prompt and troubleshooting guide in one place.
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.