Chase to main content
  1. Licks, Barks, Howls n Growls from August/

Restarting Failed Mirrored Repos in Gitlab

🐕 Attikus’ Fantastically flavored FURlosophies:
Life is short! 🐾 Chase squirrels 🐿️ Love unconditionally ❤️
…and pee on as much stuff as possible!

Dad was sitting at his pawtuter and grumbling…. he said something about busted gitlab mirrors?

….. I encouraged much belly scritching…. which seemed to help… but he was pretty intent on restarting a bunch of failed mirrored repos in GitLab

So… I helped him out… I wanted to get back to the scritching, you see… and I knew that GitLab’s Documentation1 would be pretty easy for him to follow:

Hop into the rails console: #

gitlab-rails console
root@gitlab:/# gitlab-rails console
----------------------------------------------------------------------------
 Ruby:         ruby 3.2.5 (2024-07-26 revision 31d0f1a2e7) [x86_64-linux]
 GitLab:       17.5.1-ee (e4e13234b2d) EE
 GitLab Shell: 14.39.0
 PostgreSQL:   16.4

Look and see which projects have failed: #

gitlab-rails console
Project.find_each do |p|
  if 
    p.group == mirrored_repos && 
    p.import_state && 
    p.import_state.retry_count > 14 && 
      puts "Mirroring failed #{p.import_state.retry_count} times for #{p.full_path}"
  end
end
gitlab-rails console
Mirroring failed 15 times for mirrored_repos/Not_related_to_dogs
Mirroring failed 15 times for mirrored_repos/AppleApps/Uninteresting_to_dogs
Mirroring failed 15 times for mirrored_repos/question/No_Scritches
Mirroring failed 15 times for mirrored_repos/question/No_Snacks
Mirroring failed 15 times for mirrored_repos/coolify/This_Is_Boring_Dad
Mirroring failed 15 times for mirrored_repos/coolify/Why_Are_You_Sitting_There
Mirroring failed 15 times for mirrored_repos/truenas/CLEARLY_I_Deserve_SCRITCHES
Mirroring failed 15 times for mirrored_repos/machinelearning/stability-ai/No_Dog_Repos
Mirroring failed 15 times for mirrored_repos/the-bootcamp-project/configurations/No_Dogs_Here
Mirroring failed 15 times for mirrored_repos/machinelearning/lmstudio/BARK
Mirroring failed 15 times for mirrored_repos/machinelearning/janhq/Jan_Is_Awesome
…You get the point

Reset the failure counts: #

gitlab-rails console
Project.find_each do |p|
  if p.import_state && p.import_state.retry_count >= 14
    puts "Resetting mirroring operation for #{p.full_path}"
    p.import_state.reset_retry_count
    p.import_state.set_next_execution_to_now(prioritized: true)
    p.import_state.save!
  end
end

AND we’re done!

Now…. uh… dad….
   Are uh….
     Are you….
         Are you gonna eat that sausage?