JUnit artifacts not found

JUnit results are not found when uploading artifacts while ls command shows they are at the place. Is there anything missed?

$ mix test

[94](https://gitlab.com/goofansu/brightu_umbrella/-/jobs/641420267#L94)06:57:56.602 [info] Already up

[95](https://gitlab.com/goofansu/brightu_umbrella/-/jobs/641420267#L95)==> brightu

[96](https://gitlab.com/goofansu/brightu_umbrella/-/jobs/641420267#L96)Wrote JUnit report to: /tmp/brightu-test-junit-report.xml

[97](https://gitlab.com/goofansu/brightu_umbrella/-/jobs/641420267#L97)==> brightu_web

[98](https://gitlab.com/goofansu/brightu_umbrella/-/jobs/641420267#L98)Wrote JUnit report to: /tmp/brightu_web-test-junit-report.xml

[99](https://gitlab.com/goofansu/brightu_umbrella/-/jobs/641420267#L99)[os_mon] memory supervisor port (memsup): Erlang has closed

[100](https://gitlab.com/goofansu/brightu_umbrella/-/jobs/641420267#L100)[os_mon] cpu supervisor port (cpu_sup): Erlang has closed

[101](https://gitlab.com/goofansu/brightu_umbrella/-/jobs/641420267#L101)$ ls /tmp

[102](https://gitlab.com/goofansu/brightu_umbrella/-/jobs/641420267#L102)brightu-test-junit-report.xml

[103](https://gitlab.com/goofansu/brightu_umbrella/-/jobs/641420267#L103)brightu_web-test-junit-report.xml

[105](https://gitlab.com/goofansu/brightu_umbrella/-/jobs/641420267#L105)Saving cache

00:01

[106](https://gitlab.com/goofansu/brightu_umbrella/-/jobs/641420267#L106)Not uploading cache 862aeff72a4724b92ebf4fc61daee07c2275e1bb due to policy

[108](https://gitlab.com/goofansu/brightu_umbrella/-/jobs/641420267#L108)Uploading artifacts for successful job

00:01

[109](https://gitlab.com/goofansu/brightu_umbrella/-/jobs/641420267#L109)Uploading artifacts...

[110](https://gitlab.com/goofansu/brightu_umbrella/-/jobs/641420267#L110)WARNING: /tmp/*test-junit-report.xml: no matching files

[111](https://gitlab.com/goofansu/brightu_umbrella/-/jobs/641420267#L111)ERROR: No files to upload

[113](https://gitlab.com/goofansu/brightu_umbrella/-/jobs/641420267#L113)Job succeeded

My config:

image: elixir:latest

stages:
  - build
  - test

variables:
  MIX_ENV: "test"

cache: &global_cache
  key:
    files:
      - mix.lock
  paths:
    - deps/
    - _build/test/

.job_template: &job_definition
  services:
    - postgres:latest
  variables:
    # <<: *global_variables
    POSTGRES_DB: brightu_test
    POSTGRES_HOST: postgres
    POSTGRES_USER: postgres
    POSTGRES_PASSWORD: "postgres"

before_script:
  - mix local.rebar --force
  - mix local.hex --force
  - mix deps.get --only test

build:
  stage: build
  script:
    - mix compile

format:
  stage: test
  needs: [build]
  cache:
    <<: *global_cache
    policy: pull
  script:
    - mix format --check-formatted

test:
  <<: *job_definition
  stage: test
  needs: [build]
  cache:
    <<: *global_cache
    policy: pull
  script:
    - mix ecto.create
    - mix ecto.migrate
    - mix test
  artifacts:
    reports:
      junit:
        - /tmp/*test-junit-report.xml

@goofansu - you may want to just try specifying the two file names in an array. The wildcard should be working as it closely matches up to some of the docs examples.

Good Luck!

-James H - GitLab Product Manager

1 Like

@goofansu - The other possibility is the /tmp directory is being cleared out after the ls and before the upload.

-JH

1 Like