Add Sidekiq worker to re-enable pull mirror configuration

What does this MR do and why?

Contributes to #368021 (closed)

Problem

We disable pull mirroring configuration when client downgrade their subscription. But we don't re-enable them back, in case when the subscription is extended after the downgrade.

Solution

Add a Sidekiq worker that enables previously disabled pull mirroring configurations when subscription is re-activated.

How to set up and validate locally

  1. Enable feature flag Feature.enable(:add_refresh_pull_mirror_worker)
  2. Setup a project with a pull mirror (see docs)
  3. Mark pull mirroring as hard failed
project = Project.find(<id>)
import_state = project.import_state
import_state.set_max_retry_count
import_state.save!

puts import_state.retry_count
# 15
  1. Run PullMirrors::ReenableConfigurationWorker from console
project = Project.find(<id>)
PullMirrors::ReenableConfigurationWorker.perform_async(project.namespace.id)

# wait till the job is completed

puts project.import_state.retry_count
# 0

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 Vasilii Iakliushin

Merge request reports

Loading