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

composer.rake « packages « gitlab « tasks « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c9bccfe93847515e408e080beb5eb24091bf2ee9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# frozen_string_literal: true

require 'logger'

desc "GitLab | Packages | Build composer cache"
namespace :gitlab do
  namespace :packages do
    task build_composer_cache: :environment do
      logger = Logger.new(STDOUT)
      logger.info('Starting to build composer cache files')

      ::Packages::Package.composer.find_in_batches do |packages|
        packages.group_by { |pkg| [pkg.project_id, pkg.name] }.each do |(project_id, name), packages|
          logger.info("Building cache for #{project_id} -> #{name}")
          Gitlab::Composer::Cache.new(project: packages.first.project, name: name).execute
        end
      end
    end
  end
end