如何在.gitlab-ci. yml 中指定通配符构件子目录?

我使用 GitLab CI 来构建一个 C # 解决方案,并尝试将一些构建构件从一个构建阶段传递到另一个构建阶段。

问题是,这些工件并不位于单个目录中,而是位于不同的子目录中,但是所有子目录都具有相同的名称 bin/obj/

我的 .gitlab-ci.yml看起来如下:

...
stages:
- build
- test


build:
stage: build
script:
CALL %MSBuild% ...
artifacts:
paths:
- /**/bin/
- /**/obj/
expire_in: 6 hrs


test:
stage: test
dependencies:
- build
...

我尝试用不同的方法来捕捉这些艺术品,例如。

**/bin/
**/obj/

(无效语法) ,或

.*/bin/
.*/obj/

但是没有发现任何人工制品,就像 /**/bin//**/obj/一样,给了我以下错误:

Uploading artifacts...
WARNING: /**/bin/: no matching files
WARNING: /**/obj/: no matching files

我怎样才能指定一个子目录模式来扫描工件? 或者这根本就不可能吗?

简单的使用

artifacts:
untracked: true

不是一个选项,因为一个巨大的未跟踪的 packages/子目录,这导致工件上传失败,因为一个太大的归档:

Uploading artifacts...
untracked: found 4513 files
ERROR: Uploading artifacts to coordinator... too large archive  id=36 responseStatus=413 Request Entity Too Large token=...
FATAL: Too large
59176 次浏览

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