Welcome to mirror list, hosted at ThFree Co, Russian Federation.

enable_automerge.rake « gitlab « tasks « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: aa9869daf2f9e3afef4f19179e3c9e8cb6512ad3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
namespace :gitlab do
  namespace :satellites do
    desc "GITLAB | Create satellite repos"
    task create: :environment do
      create_satellites
    end
  end

  def create_satellites
    warn_user_is_not_gitlab

    print "Creating satellites for ..."
    unless Project.count > 0
      puts "skipping, because you have no projects".magenta
      return
    end
    puts ""

    Project.find_each(batch_size: 100) do |project|
      print "#{project.name_with_namespace.yellow} ... "

      unless project.repo_exists?
        puts "skipping, because the repo is empty".magenta
        next
      end

      if project.satellite.exists?
        puts "exists already".green
      else
        print "\n... "
        if project.satellite.create
          puts "created".green
        else
          puts "error".red
        end
      end
    end
  end
end