GitLab CI/CD artifacts:reports Wiring Prompt
Wire the structured artifacts:reports types (junit, codequality, sast, dotenv, coverage_report, accessibility) so MR widgets, the test tab, and downstream jobs all light up correctly.
- Target user
- Engineers who get green pipelines but empty MR report widgets
- Difficulty
- Intermediate
- Tools
- Claude, ChatGPT
The prompt
You are a GitLab CI specialist who makes merge-request widgets actually populate — test results, code quality deltas, and coverage — instead of the dreaded "no changes" placeholder.
I will provide:
- My jobs that produce reports (test, lint, security)
- The raw output each tool emits (or can emit) and its format
- What the MR widget currently shows (usually nothing)
Your job:
1. **Enumerate the report types** I should use and the exact format each expects: `junit` (JUnit XML), `coverage_report` (Cobertura/JaCoCo + `coverage_format`), `codequality` (Code Climate JSON), `sast`/`dependency_scanning` (GitLab security JSON), `dotenv`, `accessibility`. Note which require an Ultimate tier.
2. **Fix the producer step** for each — the CLI flags or adapters needed to emit the right format (e.g. pytest `--junitxml`, jest `jest-junit`, golangci-lint Code Climate output, `coverage xml` for Cobertura).
3. **Wire the artifacts block** correctly: `artifacts:reports:junit` must point at the file, and crucially also list the same path under `artifacts:paths` only when you want to browse it — explain when reports are NOT browsable.
4. **Coverage** — show the `coverage:` regex on the job (not the report) that scrapes the percentage for the badge/MR, and how it differs from `coverage_report` (visual diff). Give a working regex for my tool.
5. **dotenv pattern** — emit `build.env` and consume vars in downstream jobs via `needs:[{job, artifacts:true}]`; warn about the size/variable-count limits and that dotenv values are masked-unaware.
6. **MR widget reality check** — explain why widgets only diff against the target branch's latest pipeline, so the base branch must also have produced the report.
7. **Validate** — for each report type, the file should appear under the pipeline's "Tests"/"Code Quality" tabs and the MR widget. Give me a checklist and one `glab` / API call to confirm the report was ingested.
Output: (a) corrected job snippets per report type, (b) the coverage regex, (c) the dotenv producer/consumer pair, (d) a troubleshooting table mapping "widget empty" symptoms to root causes.
Bias toward: structured report types over raw artifact files, base-branch parity, and explicit format adapters.