Skip to content

artifacts.reports.junit does not follow symbolic links

Summary

Artefacts step fails to collect files behind symlinked directories.

In the example below I use Bazel based test step. Note that Bazel depends heavily on symlinks.

Steps to reproduce

.gitlab-ci.yml
test:
    stage: test
    script:
        - bazel build //...
        - bazel test  //...
    after_script:
        - find -L bazel-testlogs -iname test.xml
    allow_failure: true
    artifacts:
        when: always
        reports:
            junit: "bazel-testlogs/**/test.xml"

Note that the find correctly returns a list of files if "follow symbolic link" flag -L is used.

Actual behavior

Uploading artifacts...
WARNING: bazel-testlogs/**/test.xml: no matching files      
ERROR: No files to upload     

Expected behavior

Uploading artifacts...
bazel-testlogs/**/test.xml: found 1556 matching files and directories 
Uploading artifacts as "junit" to coordinator... ok  id=74823 responseStatus=201 Created token=xyz

Environment description

Self-hosted, version 14.2.0 with docker+machine agents running on AWS EC2.

Workaround

Adding additional steps remedies the problem but adds unwanted complexity to the pipeline and impacts performance.

.gitlab-ci.yml
test:
    stage: test
    script:
        - bazel build //...
        - bazel test  //...
    after_script:
        - mkdir junit
        - find -L bazel-testlogs -iname test.xml -exec cp --parents '{}' junit/ \;
    allow_failure: true
    artifacts:
        when: always
        reports:
            junit: "junit/**/test.xml"

Other