Commit 702529c4 authored by David Fernandez's avatar David Fernandez

Merge branch '333694-remove-rake-task' into 'master'

Remove unused composer rake task

See merge request gitlab-org/gitlab!71232
parents 07a584da c674b349
# 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
# frozen_string_literal: true
require 'rake_helper'
RSpec.describe 'gitlab:packages:build_composer_cache namespace rake task', :silence_stdout do
let_it_be(:package_name) { 'sample-project' }
let_it_be(:package_name2) { 'sample-project2' }
let_it_be(:json) { { 'name' => package_name } }
let_it_be(:json2) { { 'name' => package_name2 } }
let_it_be(:group) { create(:group) }
let_it_be(:project) { create(:project, :custom_repo, files: { 'composer.json' => json.to_json }, group: group) }
let_it_be(:project2) { create(:project, :custom_repo, files: { 'composer.json' => json2.to_json }, group: group) }
let!(:package) { create(:composer_package, :with_metadatum, project: project, name: package_name, version: '1.0.0', json: json) }
let!(:package2) { create(:composer_package, :with_metadatum, project: project, name: package_name, version: '2.0.0', json: json) }
let!(:package3) { create(:composer_package, :with_metadatum, project: project2, name: package_name2, version: '3.0.0', json: json2) }
before :all do
Rake.application.rake_require 'tasks/gitlab/packages/composer'
end
subject do
run_rake_task("gitlab:packages:build_composer_cache")
end
it 'generates the cache files' do
expect { subject }.to change { Packages::Composer::CacheFile.count }.by(2)
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment