Show arbitrary build results
Problem to Solve
This is a request to allow arbitrary build results / links to be included on the status page for each build. What is a "build result"? Examples might include code coverage results, test results, output from static analysis tools, generated logs, pages with shortcut links, and more.
It is unrealistic for GitLab CI to natively support every such build result. The goal here is to provide a mechanism for arbitrary "things" to put a small blurb and/or link to themselves at the top or in the side-bar of the build page. To achieve this we will add a new option to the
artifacts: element that will track these items as being ones to highlight:
custom_output: script: generator.sh >output.txt artifacts: expose_as: "Generator Output" paths: - output.txt
Then, for any jobs that produced outputs where this new element is provided, a new section is added to the latest pipeline section in the MR widget here:
And also on the per-pipeline page. If there are multiple files in the artifacts it links you to the root folder in the artifact browser.
This new section will contain a direct link (using the provided name as the name of the link) to the artifact browser. There, any formats supported by the artifact browser (as implemented via https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/14399) would be displayed in a new tab, or downloaded if not supported. In this way generated .html or other artifacts can be coordinated and easily linked to. The generated .html could contain important content itself, or be a further list of manually generated links to any other resources.
One complaint here has been having to manually download .html artifacts, but using the artifact browser in combination with Pages as described at https://docs.gitlab.com/ee/user/project/pipelines/job_artifacts.html makes viewing .html in a new tab but without a download possible.
Artifacts - Allow artifacts to be linked to as build results, contolled by
- Example with HTML files:
- Tools like Robot Framework can generate nicely-formatted HTML files; this happens during the build
- The HTML output is collected as a build artifact
"Test Results"link appears next to the rest of the build results, which links directly to the generated HTML file
- Example with snippets:
- A custom tool would output a small snippet of HTML
In the future, we can improve this by supporting external things:
There are a few different kinds of external or artifact results that could be implemented here:
External - Allow external services to report a result to GitLab CI via the web API. Example:
- A build pushes his code coverage files to a service like codecov.io
- Codecov.io processes the coverage files and calculates a single coverage metric
- Codecov.io pushes this result to GitLab CI, via the web API
- GitLab CI shows this result in the side-bar of the build page, including a link back to the codecov.io page for that build