add #publish_mass_build_317 rake task
This commit is contained in:
parent
2f69a60aa6
commit
233e22e341
|
@ -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,41 @@ namespace :new_core do
|
|||
|
||||
say "[#{Time.zone.now}] done"
|
||||
end
|
||||
|
||||
desc 'Publish mass-build 317'
|
||||
task :publish_mass_build_317 => :environment do
|
||||
say "[#{Time.zone.now}] Starting to publish mass-build 317..."
|
||||
|
||||
BuildList.where(:mass_build_id => 317).
|
||||
where("status != #{BuildServer::BUILD_ERROR}").
|
||||
order(:id).
|
||||
find_in_batches(:batch_size => 1) do | bls |
|
||||
|
||||
bl = bls.first
|
||||
puts "[#{Time.zone.now}] - where build_lists.id #{bl.id}"
|
||||
|
||||
archive = bl.results.find{ |r| r['file_name'] =~ /.*\.tar\.gz$/ }
|
||||
sha1 = archive['sha1']
|
||||
|
||||
root_folder = "#{bl.save_to_platform.path}/repository/#{bl.arch.name}/main"
|
||||
system "cd #{root_folder} && curl -L -O http://file-store.rosalinux.ru/api/v1/file_stores/#{sha1}"
|
||||
system "cd #{root_folder} && tar -xzf #{sha1}"
|
||||
system "rm -f #{root_folder}/#{sha1}"
|
||||
|
||||
archive_folder = "#{root_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/* #{root_folder}/release/"
|
||||
system "sudo mv #{archive_folder}/RPM/* #{root_folder}/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