#276: Send script name at publish/resign/etc

This commit is contained in:
Vokhmin Alexey V 2013-08-26 20:25:41 +04:00
parent 0d70dec86e
commit fd3f096402
2 changed files with 22 additions and 20 deletions

View File

@ -89,6 +89,8 @@ module AbfWorker
'args' => [{ 'args' => [{
:id => build_list.id, :id => build_list.id,
:cmd_params => cmd_params, :cmd_params => cmd_params,
:main_script => 'build.sh',
:rollback_script => 'rollback.sh',
:platform => { :platform => {
:platform_path => platform_path, :platform_path => platform_path,
:type => distrib_type, :type => distrib_type,
@ -96,7 +98,6 @@ module AbfWorker
:arch => build_list.arch.name :arch => build_list.arch.name
}, },
:repository => {:id => build_list.save_to_repository_id}, :repository => {:id => build_list.save_to_repository_id},
:type => :publish,
:time_living => 9600, # 160 min :time_living => 9600, # 160 min
:packages => packages, :packages => packages,
:old_packages => packages_structure, :old_packages => packages_structure,
@ -168,6 +169,7 @@ module AbfWorker
'args' => [{ 'args' => [{
:id => r.id, :id => r.id,
:cmd_params => cmd_params, :cmd_params => cmd_params,
:main_script => 'resign.sh',
:platform => { :platform => {
:platform_path => "#{r.platform.path}/repository", :platform_path => "#{r.platform.path}/repository",
:type => distrib_type, :type => distrib_type,
@ -175,10 +177,9 @@ module AbfWorker
:arch => 'x86_64' :arch => 'x86_64'
}, },
:repository => {:id => r.id}, :repository => {:id => r.id},
:type => :resign,
:skip_feedback => true, :skip_feedback => true,
:time_living => 9600, # 160 min :time_living => 9600, # 160 min
:extra => {:repository_status_id => repository_status.id} :extra => {:repository_status_id => repository_status.id, :resign => true}
}] }]
) if repository_status.start_resign ) if repository_status.start_resign
end end
@ -276,6 +277,8 @@ module AbfWorker
options = { options = {
:id => (bl ? bl.id : Time.now.to_i), :id => (bl ? bl.id : Time.now.to_i),
:cmd_params => cmd_params, :cmd_params => cmd_params,
:main_script => 'build.sh',
:rollback_script => 'rollback.sh',
:platform => { :platform => {
:platform_path => platform_path, :platform_path => platform_path,
:type => distrib_type, :type => distrib_type,
@ -283,7 +286,6 @@ module AbfWorker
:arch => (bl ? bl.arch.name : 'x86_64') :arch => (bl ? bl.arch.name : 'x86_64')
}, },
:repository => {:id => save_to_repository_id}, :repository => {:id => save_to_repository_id},
:type => :publish,
:time_living => 9600, # 160 min :time_living => 9600, # 160 min
:extra => {:repository_status_id => repository_status.id} :extra => {:repository_status_id => repository_status.id}
} }
@ -342,14 +344,13 @@ module AbfWorker
'args' => [{ 'args' => [{
:id => Time.now.to_i, :id => Time.now.to_i,
:cmd_params => cmd_params, :cmd_params => cmd_params,
:main_script => 'regenerate_platform_metadata.sh',
:platform => { :platform => {
:platform_path => "#{platform.path}/repository", :platform_path => "#{platform.path}/repository",
:type => platform.distrib_type, :type => platform.distrib_type,
:name => platform.name, :name => platform.name,
:arch => 'x86_64' :arch => 'x86_64'
}, },
:repository => {:id => platform.repositories.first.id},
:type => :publish,
:time_living => 9600, # 160 min :time_living => 9600, # 160 min
:skip_feedback => true, :skip_feedback => true,
:extra => {:platform_id => platform.id, :regenerate_platform => true} :extra => {:platform_id => platform.id, :regenerate_platform => true}
@ -385,14 +386,14 @@ module AbfWorker
'args' => [{ 'args' => [{
:id => Time.now.to_i, :id => Time.now.to_i,
:cmd_params => cmd_params, :cmd_params => cmd_params,
:main_script => 'build.sh',
:rollback_script => 'rollback.sh',
:platform => { :platform => {
:platform_path => "#{rep.platform.path}/repository", :platform_path => "#{rep.platform.path}/repository",
:type => build_for_platform.distrib_type, :type => build_for_platform.distrib_type,
:name => build_for_platform.name, :name => build_for_platform.name,
:arch => 'x86_64' :arch => 'x86_64'
}, },
:repository => {:id => rep.id},
:type => :publish,
:time_living => 9600, # 160 min :time_living => 9600, # 160 min
:skip_feedback => true, :skip_feedback => true,
:extra => {:repository_status_id => repository_status.id, :regenerate => true} :extra => {:repository_status_id => repository_status.id, :regenerate => true}

View File

@ -9,18 +9,19 @@ module AbfWorker
def perform def perform
return if status == STARTED # do nothing when publication started return if status == STARTED # do nothing when publication started
repository_status = RepositoryStatus.where(:id => options['extra']['repository_status_id']) extra = options['extra']
repository_status = RepositoryStatus.where(:id => extra['repository_status_id'])
begin begin
if options['extra']['regenerate'] # Regenerate metadata if extra['regenerate'] # Regenerate metadata
repository_status.last_regenerated_at = Time.now.utc repository_status.last_regenerated_at = Time.now.utc
repository_status.last_regenerated_status = status repository_status.last_regenerated_status = status
elsif options['extra']['regenerate_platform'] # Regenerate metadata for Software Center elsif extra['regenerate_platform'] # Regenerate metadata for Software Center
if platform = Platform.where(:id => options['extra']['platform_id'])).first if platform = Platform.where(:id => extra['platform_id'])).first
platform.last_regenerated_at = Time.now.utc platform.last_regenerated_at = Time.now.utc
platform.last_regenerated_status = status platform.last_regenerated_status = status
platform.ready platform.ready
end end
elsif options['extra']['create_container'] # Container has been created elsif extra['create_container'] # Container has been created
case status case status
when COMPLETED when COMPLETED
subject.published_container subject.published_container
@ -28,7 +29,7 @@ module AbfWorker
subject.fail_publish_container subject.fail_publish_container
end end
update_results update_results
else elsif !extra['resign'] # Simple publish
update_rpm_builds update_rpm_builds
end end
ensure ensure