Allow linking to single file in build artifact directory
Problem to solve
Some types of build artifacts (e.g. gcovr
HTML coverage reports) are directories containing an index.html
and a lot of other files (e.g. other .html
files, as well as a .css
stylesheet). When using the expose_as
feature, GitLab will only link to the entire directory.
I want a way to link directly to the index.html
in a case like this.
Further details
Example .gitlab-ci.yml
file:
test:
script:
- ...
- ninja coverage-html
artifacts:
expose_as: Coverage HTML Report
paths:
- coverage/
If I directly specify the coverage/index.html
instead of coverage/
, the resulting build artifact HTML appears broken (links will 404). If I try specifying both the coverage/index.html
and the coverage/
directory, it behaves identically to only specifying the coverage/
dir.
Proposal
A straightforward way would be to simply special-case index.html
, and automagically treat exposed directories that contain an index.html
as links to that HTML file.
However, a more sophisticated approach might be allow passing a key/value list instead of a string for expose_as
, with new attributes like:
test:
script:
- ...
- ninja coverage-html
artifacts:
expose_as:
path: coverage/index.html
name: Coverage HTML Report
paths:
- coverage/