#755: update path to platform for personal platforms, some refactoring
This commit is contained in:
parent
f00b168b20
commit
1c51a2d514
|
@ -267,16 +267,27 @@ class BuildList < ActiveRecord::Base
|
||||||
def publish_container
|
def publish_container
|
||||||
type = save_to_platform.distrib_type
|
type = save_to_platform.distrib_type
|
||||||
archive = results.select{ |r| r['file_name'] =~ /.*\.tar\.gz$/}[0]
|
archive = results.select{ |r| r['file_name'] =~ /.*\.tar\.gz$/}[0]
|
||||||
|
|
||||||
|
platform_path = "#{APP_CONFIG[root]}/platforms/#{save_to_platform.name}"
|
||||||
|
if save_to_platform.personal?
|
||||||
|
platform_path << '/'
|
||||||
|
platform_path << build_for_platform.name
|
||||||
|
Dir.mkdir(platform_path) unless File.exists?(platform_path)
|
||||||
|
end
|
||||||
|
|
||||||
Resque.push(
|
Resque.push(
|
||||||
"publish_build_list_container_#{type}_worker",
|
"publish_build_list_container_#{type}_worker",
|
||||||
'class' => "AbfWorker::PublishBuildListContainer#{type.capitalize}Worker",
|
'class' => "AbfWorker::PublishBuildListContainer#{type.capitalize}Worker",
|
||||||
'args' => [{
|
'args' => [{
|
||||||
:id => id,
|
:id => id,
|
||||||
:released => save_to_platform.released,
|
|
||||||
:arch => arch.name,
|
:arch => arch.name,
|
||||||
:distrib_type => type,
|
:distrib_type => type,
|
||||||
:container_sha1 => archive['sha1'],
|
:container_sha1 => archive['sha1'],
|
||||||
:platform_path => "#{APP_CONFIG[root]}/platforms/#{save_to_platform.name}/",
|
:platform => {
|
||||||
|
:platform_path => platform_path,
|
||||||
|
:released => save_to_platform.released
|
||||||
|
},
|
||||||
|
:repository_name => save_to_repository.name,
|
||||||
:time_living => 1800 # 30 min
|
:time_living => 1800 # 30 min
|
||||||
}]
|
}]
|
||||||
)
|
)
|
||||||
|
|
|
@ -17,8 +17,7 @@ module AbfWorker
|
||||||
pbl.build_canceled
|
pbl.build_canceled
|
||||||
end
|
end
|
||||||
if status != BUILD_STARTED
|
if status != BUILD_STARTED
|
||||||
pbl.results = options['results']
|
update_results(pbl, options)
|
||||||
pbl.save!
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -5,5 +5,12 @@ module AbfWorker
|
||||||
BUILD_PENDING = 2
|
BUILD_PENDING = 2
|
||||||
BUILD_STARTED = 3
|
BUILD_STARTED = 3
|
||||||
BUILD_CANCELED = 4
|
BUILD_CANCELED = 4
|
||||||
|
|
||||||
|
def update_results(subject, options)
|
||||||
|
results = (subject.results || [])+ options['results']
|
||||||
|
subject.results = results.sort_by{ |r| r['file_name'] }
|
||||||
|
subject.save!
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -19,16 +19,5 @@ module AbfWorker
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class << self
|
|
||||||
protected
|
|
||||||
|
|
||||||
def update_results(bl, options)
|
|
||||||
results = bl.results + options['results']
|
|
||||||
bl.results = results.sort_by{ |r| r['file_name'] }
|
|
||||||
bl.save!
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -52,9 +52,11 @@ module AbfWorker
|
||||||
container = (options['results'] || []).
|
container = (options['results'] || []).
|
||||||
select{ |r| r['file_name'] !~ /.*\.log$/ }.first
|
select{ |r| r['file_name'] !~ /.*\.log$/ }.first
|
||||||
sha1 = container ? container['sha1'] : nil
|
sha1 = container ? container['sha1'] : nil
|
||||||
bl.results = options['results']
|
if sha1
|
||||||
bl.container_path = "#{APP_CONFIG['file_store_url']}/#{sha1}" if sha1
|
bl.container_path = "#{APP_CONFIG['file_store_url']}/#{sha1}"
|
||||||
bl.save!
|
bl.save!
|
||||||
|
end
|
||||||
|
update_results(bl, options)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue