Skip to content

Make it easier for admins to resync project mirrors

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

@dstanley and I were on a customer call, and the database encryption key was switched so most of the project_mirror_data were undecipherable, resulting in OpenSSL errors. We ended up finding all the invalid entries via:

ProjectImportData.find_each do |data|
  begin
    data.credentials
  rescue => e
    puts data.id
   end
end

The customer was trying to force an update of a scheduled mirror, but it was stuck in the "Update Scheduled" state.

Attempting to force a sync via:

UpdateAllMirrorsWorker.new.perform

Would result in nothing happening. We checked ProjectMirrorData#next_execution_timestamp and Project#import_status and tried to modify the values to do something.

RepositoryUpdateMirrorWorker.new.perform(project.id)

Would result in such error messages as:

Project build/test/redis_exporter was in inconsistent state: finished

@dstanley I think this works:

project = Project.find_by_full_path('build/test/redis_exporter')
project.import_fail('manually failed')
project.mirror_data.update(next_execution_timestamp: Time.now)
UpdateAllMirrorsWorker.new.perform

I think there needs be a number of improvements:

  1. Admins (or someone with special privileges) should be able to cancel and schedule an import immediately
  2. UpdateAllMirrorsWorker should not fail if a single entry in the database has corrupted attr_encrypted fields

/cc: @tiagonbotelho, @DouweM

Edited by 🤖 GitLab Bot 🤖