After 17.4.5 junit artifacts disrupt junit report ingestion

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Summary

When a copy of the artifacts.reports.junit file is copied to a different path, which is also registered in artifacts.paths, the Test summary output is 0.

Possible, buggy side effect of https://gitlab.com/gitlab-org/security/gitlab/-/issues/1171 but I could be wrong, as there are almost 3 dozen junit changes:

$ git diff v17.3.7-ee v17.4.5-ee | rg --count '^[-+].+junit'
34

Marking as confidential for now, because it's possibly related to a bugvulnerability although not clearly being one itself.

Steps to reproduce

Reported by a customer internally.

A) On GitLab v17.3.3, have a job config like:

job_with_tests:
  
  after_script:
    - cp ./**/test-reports/TEST-*.xml ./test-reports
  artifacts:
   paths:
   - test-reports/
   reports:
     junit:
     - '**/test-reports/TEST-*.xml'

B) Upgrade to v17.4.5 and re-trigger a new job_with_tests.

Example Project

What is the current bug behavior?

After the upgrade, job logs contain test-reports: found …2x… matching … files as before, and the UI reports Test summary: 0.

What is the expected correct behavior?

The same number of test-reports: found … matching … and the same Test summary: number as before.

Relevant logs and/or screenshots

See extracts above or longer snippets in above-linked customer report.

Output of checks

Results of GitLab environment info

Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:env:info`)

(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)

Results of GitLab application Check

Expand for output related to the GitLab application check

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:check SANITIZE=true)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)

(we will only investigate if the tests are passing)

Possible fixes

CCing @mfanGitLab @hfyngvason as likely experts

Edited by 🤖 GitLab Bot 🤖