Skip to content
Latchkey

GitLab CI "artifacts:reports" Not Shown - junit/dotenv Report Ignored

artifacts:reports ingests structured output - JUnit test results, a dotenv file of variables, coverage reports. The data is dropped silently when the path is wrong, the file is empty, or its format is invalid.

What this error means

Tests run but the MR "Tests" tab is empty, or a dotenv variable set by one job is undefined in the next. The report path or format does not match what GitLab expects, so the report is ignored without a hard error.

Job config
# JUnit tab empty - the report path does not match where the file was written:
test:
  script: pytest --junitxml=report.xml
  artifacts:
    reports:
      junit: junit.xml   # wrong filename: file is report.xml

Common causes

Report path does not match the produced file

The reports:junit (or dotenv) path must point at the exact file the job wrote. A wrong name or directory means GitLab finds nothing to ingest.

Empty or invalid report file

A JUnit XML with no test cases, or a malformed dotenv file (spaces around =, quoted values), is parsed as empty and contributes nothing.

dotenv variables not consumed via needs/dependencies

A reports:dotenv propagates variables only to jobs that depend on the producer. Without the dependency link the downstream job never receives them.

How to fix it

Point reports at the real file

.gitlab-ci.yml
test:
  script: pytest --junitxml=report.xml
  artifacts:
    reports:
      junit: report.xml

Pass dotenv vars through a dependency

Emit a valid dotenv file and consume it via needs/dependencies in the next job.

.gitlab-ci.yml
build:
  script: echo "BUILD_ID=$(date +%s)" > build.env
  artifacts:
    reports:
      dotenv: build.env

deploy:
  needs: [build]
  script: echo "deploying $BUILD_ID"

How to prevent it

  • Keep the reports: path identical to the file the job produces.
  • Validate JUnit XML is non-empty and dotenv lines are KEY=value.
  • Link producer and consumer with needs so dotenv vars propagate.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →