Skip to content

Keep job expanded while deleting artifact from it

What does this MR do and why?

For #370150 (closed)

This MR preserves the expanded state of the rows in the job artifacts table when an artifact is deleted - without it, the rows all return to their default collapsed state when an artifact is deleted. It accomplishes this by adding a local-only field called _showDetails to the job stored in the Apollo cache, which is used by the table to determine whether to show the extra row-details for that row. Then when a row is expanded or collapsed, we update its _showDetails value in the cache.

Screenshots or screen recordings

before after
Screen_Recording_2022-11-01_at_13.15.06 Screen_Recording_2022-11-01_at_13.13.47

How to set up and validate locally

  1. echo "Feature.enable(:artifacts_management_page)" | bundle exec rails console
  2. git checkout 370150-keep-job-expanded-when-deleting-artifact
  3. find/make/import a project with a pipeline with a job that generates more than one artifact
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. expand a job that has more than one artifact
  4. delete one of its artifacts
  5. check that the job is still expanded after the delete operation is complete

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