How to specify wildcard artifacts subdirectories in .gitlab-ci.yml?

The gitlab-ci-multi-runner build runner is built using Go and currently uses filepath.Glob() to scan for any specified artifacts in file_archiver.go.

Go doesn’t seem to support the double star glob expression as discussed in another question here at SO. So there seem to be no way to use a full-featured **/bin expression at the moment.

Because however all my projects are located at the same level below the solution root, it is still possible to use something like

artifacts:
  paths:
    - "*/bin"
    - "*/obj"

Note that the quotes (") seem to be required, as well as no trailing path separator at the end.

It should also be possible to explicitly add more levels by adding more globbing expressions (as described here):

paths:
  ...
  - "*/obj"
  - "*/*/bin"
  - "*/*/obj"
  ...

GitLab is tracking this issue here, and will possibly be fixed in a future version.

UPD: due to mentioned issue is closed and due to documentation, since GitLab runner 13.0 it supports doublestar.Glob.

So it is now possible to write something like this:

paths:
  - "**/bin"
  - "**/obj"

And it will include all nested directories with names bin and obj in artifacts

Leave a Comment