Skip to content

Disable browse button when job has no metadata.gz or no artifacts

Miranda Fluharty requested to merge 378959-disable-browse-if-no-metadata into master

What does this MR do and why?

For #378959 (closed), #388848 (closed)

This MR disables the browse button next to a job on the artifacts page (CI/CD > Artifacts) if the job has no metadata.gz file, because the metadata.gz file holds the data used to render the page that the browse button links to.

Screenshots or screen recordings

before with this MR
Screenshot_2023-05-05_at_17.25.10 Screenshot_2023-05-05_at_17.24.30
browse button enabled even when there's no metadata.gz for that job, leads to 404 👇🏻 browse button disabled when there's no metadata.gz for that job
Screenshot_2023-05-05_at_17.25.34

How to set up and validate locally

  1. git checkout 378959-disable-browse-if-no-metadata
  2. find/make a project with a pipeline that generates artifacts
you can use this CI yaml to generate some sample artifacts:
# .gitlab-ci.yml

potato:
  stage: build
  script:
    - echo 'potato' >> potato.txt
  artifacts:
    expose_as: 'potato'
    paths: ['potato.txt']

tomato:
  stage: build
  script:
    - echo 'tomato' >> tomato.txt
  artifacts:
    expose_as: 'tomato'
    paths: ['tomato.txt']

pineapple:
  stage: build
  script:
    - echo 'pineapple' >> pineapple.txt
  artifacts:
    expose_as: 'pineapple'
    paths: ['pineapple.txt']

apple:
  stage: build
  script:
    - echo 'apple' >> apple.txt
  artifacts:
    expose_as: 'apple'
    paths: ['apple.txt']
  1. run some pipelines to generate some artifacts
  2. navigate to the project and choose CI/CD => Artifacts in the sidebar (or Build => Artifacts in the new sidebar)
  3. each job's browse button should be dependent on the presence of an artifact file called metadata.gz
    • if a job has a metadata.gz file, clicking its browse button should take you to the browse page
    • if a job has no metadata.gz file, its browse button should be disabled

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

  • If you delete a job's metadata.gz but don't reload the page, does the browse button still get disabled for that job?

yes:

Screen_Recording_2023-05-23_at_12.48.38

Edited by Miranda Fluharty

Merge request reports