We're migrating our CI from Phabricator/Jenkins to Gitlab and the UX for viewing docs is really not very good. The current workflow from the Merge Request page is
Click build icon > click stage (e.g. build docs) > click Browse button under Job artifacts > click docs directory > click _build directory > click html directory > click index.html link
Seven clicks in all. With Phabricator, the Jenkins bot used to comment in the MR with a link to the docs page, so you could view the docs with a single click. Is there a way to do this with Gitlab?
(I would also like to do the same for coverage and lint reports, but will ask those questions separately, unless anyone has an easy solution that could be applied to all three types of artifact.)
You can use artifacts:expose_as, which links the created artifacts in a section below the most recent pipeline status on the MR overview page.
Example job:
job:
image: alpine:latest
script:
- echo foo > bar.txt
artifacts:
expose_as: 'Job Report'
paths:
- 'bar.txt'
Common coverage and lint reports can be included with artifacts:reports.
Another option is to make use of the predictable URL pattern, as described by @KamilCuk, with environment:url. Here is an example to expose storybook:
storybook:
extends: .storybook_build
environment:
name: storybook-$CI_COMMIT_REF_SLUG
url: 'https://<org>.gitlab.io/-/<path>/<project>/-/jobs/$CI_JOB_ID/artifacts/storybook/index.html'
artifacts:
paths:
- 'storybook/'
expire_in: 4 weeks
allow_failure: true
This is just one click away from the MR page.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With