Skip to content

Limit selected artifacts to 50

What does this MR do and why?

For #33348 (closed)

🎏 This feature is behind the artifacts_management_page and ci_job_artifact_bulk_destroy feature flags.

This MR caps the number of artifacts that can be selected at 50 to match the maximum number of artifacts that the bulkDestroyJobArtifacts mutation can handle (see JOB_ARTIFACTS_COUNT_LIMIT).

Screenshots or screen recordings

note: This recording was taken with SELECTED_ARTIFACTS_MAX_COUNT set to 10

Screen_Recording_2023-04-14_at_17.13.09

How to set up and validate locally

  1. echo "Feature.enable(:artifacts_management_page)" | bundle exec rails console to show the artifacts page (and the link to it in the sidebar)
  2. echo "Feature.enable(:ci_job_artifact_bulk_destroy)" | bundle exec rails console to enable more than one artifact to be deleted at once
  3. git checkout 33348-limit-number-of-artifacts-that-can-be-selected
  4. find/make/import a project with a pipeline with a job 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']

toblerone:
  stage: build
  script:
    - echo 'toblerone' >> toblerone.txt
  artifacts:
    expose_as: 'toblerone'
    paths: ['toblerone.txt']
  1. run a pipeline for that project - for this you'll need to set up a local runner for GDK or enable runners in gitpod
  2. navigate to the project, and in the sidebar select CI/CD => Artifacts
  3. select 50 artifacts OR edit SELECTED_ARTIFACTS_MAX_COUNT in app/assets/javascripts/ci/artifacts/constants.js to make it a lower number and select that many artifacts
  4. an alert should appear at the top of the page
  5. you should able to un-check artifacts, but be unable to select any more artifacts (unselected artifacts' checkboxes should be disabled, but selected artifacts' checkboxes should still be enabled)

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