Skip to content

Remove `count` from artifacts page

What does this MR do and why?

🎏 This page is behind the artifacts_management_page feature flag

What: This MR removes code that used the count field from the artifacts GraphQL query; the pagination will now rely on hasPrevPage/hasNextPage instead.

Why: We cannot count the artifacts efficiently without adding a new index to to the ci_builds database table, which we are not ready/willing to do right now, so the count field was removed in !110626 (merged)

Screenshots or screen recordings

before: pagination does not appear with this MR: pagination appears and works
Screen_Recording_2023-03-06_at_14.00.14 Screen_Recording_2023-03-06_at_13.58.07

How to set up and validate locally

  1. git checkout mfluharty-remove-file-count-from-artifacts-page
  2. echo "Feature.enable(:artifacts_management_page)" | bundle exec rails console to enable the feature flag
  3. find/make a project that generates artifacts
you can use this CI yaml to generate some sample artifacts to manage:
# .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']

toblerone:
  stage: build
  script:
    - echo 'toblerone' >> toblerone.txt
  artifacts:
    expose_as: 'toblerone'
    paths: ['toblerone.txt']
  1. run enough pipelines to have >20 jobs with artifacts OR set JOBS_PER_PAGE to a number less than the number of jobs with artifacts
  2. make sure the pagination works

to run tests

  1. bundle exec rspec spec/frontend/fixtures/job_artifacts.rb to generate the fixture
  2. yarn install && yarn jest spec/frontend/artifacts/components/job_artifacts_table_spec.js

MR acceptance checklist

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

Edited by Miranda Fluharty

Merge request reports

Loading