firecow / gitlab-ci-local

Tired of pushing to test your .gitlab-ci.yml?
MIT License
2.24k stars 127 forks source link

JUnit report artifacts not exported #615

Closed haydenseitz closed 1 year ago

haydenseitz commented 1 year ago

Minimal .gitlab-ci.yml illustrating the issue

---
test_artifact:
  script:
    - touch junit.xml
    - touch test.env
  artifacts:
    reports:
      junit: junit.xml
      dotenv: test.env

Expected behavior Junit reports are exported at the end of the job.

Actual behavior Junit is not exported. In above example, only the dotenv file is exported

Host information Ubuntu 20.04.4 gitlab-ci-local 4.34.0

Additional context

Job output from above example:

$ gitlab-ci-local test_artifact
parsing and downloads finished in 164 ms
test_artifact      starting shell (tests)
test_artifact      $ touch junit.xml
test_artifact      $ touch test.env
test_artifact      exported artifacts in 13 ms
test_artifact      finished in 29 ms

Editor showing only test.env artifact: image

When trying to only export a junit report, it returns "no artifacts was copied":

test_artifact:
  stage: tests
  script:
    - touch junit.xml
  artifacts:
    reports:
      junit: junit.xml

Job output:

$ gitlab-ci-local test_artifact
parsing and downloads finished in 221 ms
test_artifact      starting shell (tests)
test_artifact      $ touch junit.xml
test_artifact      !! no artifacts was copied !!
test_artifact      finished in 23 ms
firecow commented 1 year ago

You just want the !! no artifacts was copied !! to be removed, or do you want the tool to actually do something with the report.junit file?

haydenseitz commented 1 year ago

Thinking it through, exporting reports aside from dotenv would not do much, eh?

In my case, I was updating jobs to export junit reports, and because it was failing/not exporting in gitlab-ci-local, I thought there was a problem with my config. So, maybe just updating the job log to say that gitlab-ci-local only exports dotenv reports would be helpful.

ichistmeinname commented 1 year ago

Not sure I'm completely on-track here, but in a non-local version -- i.e., the original GitLab job -- wouldn't produce a junit artifact either, you need to expose it via the paths keywords as usual artifacts. The reports keyword -- as far as I remember -- has the effect that the resulting report is shown in the tests tab of the pipeline.