Skip to content

Disable image deletion during registry migration

Steve Abrams requested to merge 356108-delete-container-repo-message into master

🌻 What does this MR do and why?

We are in the process of migrating all container repositories to the new container registry.

While a given container repository is importing, users are not able to delete it or its underlying tags. In #352079 (closed), we added a custom message when a tag deletion fails due to this import process.

In this MR, we disable the delete button for the container repository while it is being imported on the container repository list page.

📷 Screenshots or screen recordings

Not importing Importing
Screen_Shot_2022-04-13_at_1.13.01_PM Screen_Shot_2022-04-14_at_12.05.00_PM

💻 How to set up and validate locally

  1. Create a container repository in a project by pushing an image, or using FactoryBot in the rails console:
    # it might be helpful to note the ID of the created record here
    FactoryBot.create(:container_repository, project: Project.last)
  2. Visit the project page, then navigate to Packages & Registries -> Container Registry. The container repository you created should be visible and the delete button should be active.
  3. In the rails or postgresql console, update the container repository migration_state to 'importing':
    # in the rails console
    ContainerRepository.last.update_column(:migration_state, 'importing')
    
    # in the psql console
    UPDATE container_repositories SET migration_state = 'importing' WHERE id = <your container repository id here>
  4. Reload the container registry page in the UI. The delete button should no longer be active and a tooltip should appear upon hovering.

🛃 MR acceptance checklist

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

Related #356108 (closed)

Edited by Steve Abrams

Merge request reports