Merge pull request #827 from warpc/publish-mass-build
Publish mass_build 317 (temporarily task)
This commit is contained in:
commit
6a3310bf99
|
@ -273,7 +273,7 @@ class BuildList < ActiveRecord::Base
|
|||
|
||||
def publish_container
|
||||
type = build_for_platform.distrib_type
|
||||
archive = results.select{ |r| r['file_name'] =~ /.*\.tar\.gz$/}[0]
|
||||
archive = results.find{ |r| r['file_name'] =~ /.*\.tar\.gz$/ }
|
||||
|
||||
platform_path = "#{save_to_platform.path}/repository"
|
||||
if save_to_platform.personal?
|
||||
|
|
|
@ -14,4 +14,44 @@ namespace :new_core do
|
|||
|
||||
say "[#{Time.zone.now}] done"
|
||||
end
|
||||
|
||||
desc 'Publish mass-build 73'
|
||||
task :publish_mass_build_73 => :environment do
|
||||
say "[#{Time.zone.now}] Starting to publish mass-build 317..."
|
||||
|
||||
bl = BuildList.where(:mass_build_id => 73).first
|
||||
platform_repository_folder = "#{bl.save_to_platform.path}/repository"
|
||||
BuildList.where(:mass_build_id => 73).
|
||||
where(:status => [
|
||||
BuildServer::SUCCESS,
|
||||
BuildList::FAILED_PUBLISH
|
||||
]).
|
||||
order(:id).
|
||||
find_in_batches(:batch_size => 1) do | bls |
|
||||
|
||||
bl = bls.first
|
||||
puts "[#{Time.zone.now}] - where build_lists.id #{bl.id}"
|
||||
|
||||
sha1 = bl.results.find{ |r| r['file_name'] =~ /.*\.tar\.gz$/ }['sha1']
|
||||
|
||||
system "cd #{platform_repository_folder} && curl -L -O http://file-store.rosalinux.ru/api/v1/file_stores/#{sha1}"
|
||||
system "cd #{platform_repository_folder} && tar -xzf #{sha1}"
|
||||
system "rm -f #{platform_repository_folder}/#{sha1}"
|
||||
|
||||
archive_folder = "#{platform_repository_folder}/archives"
|
||||
system "sudo chown root:root #{archive_folder}/SRC_RPM/*"
|
||||
system "sudo chmod 0666 #{archive_folder}/SRC_RPM/*"
|
||||
system "sudo chown root:root #{archive_folder}/RPM/*"
|
||||
system "sudo chmod 0666 #{archive_folder}/RPM/*"
|
||||
|
||||
system "sudo mv #{archive_folder}/SRC_RPM/* #{platform_repository_folder}/SRPMS/main/release/"
|
||||
system "sudo mv #{archive_folder}/RPM/* #{platform_repository_folder}/#{bl.arch.name}/main/release/"
|
||||
|
||||
system "sudo rm -rf #{archive_folder}"
|
||||
bl.update_column(:status, BuildList::BUILD_PUBLISH)
|
||||
end
|
||||
|
||||
say "[#{Time.zone.now}] done"
|
||||
end
|
||||
|
||||
end
|
Loading…
Reference in New Issue