Skip to content

Hide exposed artifacts when there are none

What does this MR do and why?

#⃣ for #439145 (closed)

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

  1. git checkout master
  2. open a merge request in a project
  3. 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
  1. run a pipeline for the merge request
  2. the exposed artifacts widget will appear, but it will show "View 0 artifacts" and do nothing when expanded 🐛

test the fix

  1. git checkout 439145-hide-exposed-artifacts-widget-when-no-artifacts
  2. refresh the MR page
  3. the widget should still show the loading state while loading, but disappear once it knows there are no artifacts 🎉
  4. trigger the manual job, the exposed artifact should still appear once it does exist:

Screen_Recording_2024-02-07_at_15.55.35

Edited by Miranda Fluharty

Merge request reports