Hide exposed artifacts when there are none
What does this MR do and why?
Hide exposed artifacts when there are no artifacts to show
Why? merge_request.has_exposed_artifacts?
can be true in some cases even when the endpoint returns []
:
- when the artifacts are generated by a manual job
- when the artifacts are generated by a job that
needs
a manual job - when the artifacts are being retrieved from a downstream pipeline (as in
e2e:code-suggestions-eval-results
)
... but it doesn't make sense to show the empty exposed artifacts widget in these cases.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
Screen_Recording_2024-02-07_at_15.19.03 | Screen_Recording_2024-02-07_at_15.21.39 |
How to set up and validate locally
reproduce the bug
git checkout master
- open a merge request in a project
- edit
.gitlab-ci.yml
to expose some artifacts in a job that depends on a manual job:
manual-job:
when: manual
script:
- echo "i am a manual job"
job-that-needs-manual-job:
needs:
- manual-job
script:
- echo "hello" >> artifact.json
artifacts:
expose_as: 'artifact from job that depends on manual job'
paths:
- artifact.json
- run a pipeline for the merge request
- the exposed artifacts widget will appear, but it will show "View 0 artifacts" and do nothing when expanded
🐛
test the fix
git checkout 439145-hide-exposed-artifacts-widget-when-no-artifacts
- refresh the MR page
- the widget should still show the loading state while loading, but disappear once it knows there are no artifacts
🎉 - trigger the manual job, the exposed artifact should still appear once it does exist:
Edited by Miranda Fluharty