From fd3f096402e5248b2416b53de7e835571166d07e Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Mon, 26 Aug 2013 20:25:41 +0400 Subject: [PATCH] #276: Send script name at publish/resign/etc --- .../build_lists_publish_task_manager.rb | 29 ++++++++++--------- lib/abf_worker/publish_observer.rb | 13 +++++---- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/lib/abf_worker/build_lists_publish_task_manager.rb b/lib/abf_worker/build_lists_publish_task_manager.rb index 28fc4611b..822e94407 100644 --- a/lib/abf_worker/build_lists_publish_task_manager.rb +++ b/lib/abf_worker/build_lists_publish_task_manager.rb @@ -89,6 +89,8 @@ module AbfWorker 'args' => [{ :id => build_list.id, :cmd_params => cmd_params, + :main_script => 'build.sh', + :rollback_script => 'rollback.sh', :platform => { :platform_path => platform_path, :type => distrib_type, @@ -96,7 +98,6 @@ module AbfWorker :arch => build_list.arch.name }, :repository => {:id => build_list.save_to_repository_id}, - :type => :publish, :time_living => 9600, # 160 min :packages => packages, :old_packages => packages_structure, @@ -168,6 +169,7 @@ module AbfWorker 'args' => [{ :id => r.id, :cmd_params => cmd_params, + :main_script => 'resign.sh', :platform => { :platform_path => "#{r.platform.path}/repository", :type => distrib_type, @@ -175,10 +177,9 @@ module AbfWorker :arch => 'x86_64' }, :repository => {:id => r.id}, - :type => :resign, :skip_feedback => true, :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 end @@ -274,8 +275,10 @@ module AbfWorker }.map{ |k, v| "#{k}=#{v}" }.join(' ') options = { - :id => (bl ? bl.id : Time.now.to_i), - :cmd_params => cmd_params, + :id => (bl ? bl.id : Time.now.to_i), + :cmd_params => cmd_params, + :main_script => 'build.sh', + :rollback_script => 'rollback.sh', :platform => { :platform_path => platform_path, :type => distrib_type, @@ -283,7 +286,6 @@ module AbfWorker :arch => (bl ? bl.arch.name : 'x86_64') }, :repository => {:id => save_to_repository_id}, - :type => :publish, :time_living => 9600, # 160 min :extra => {:repository_status_id => repository_status.id} } @@ -340,16 +342,15 @@ module AbfWorker 'publish_worker_default', 'class' => 'AbfWorker::PublishWorkerDefault', 'args' => [{ - :id => Time.now.to_i, - :cmd_params => cmd_params, + :id => Time.now.to_i, + :cmd_params => cmd_params, + :main_script => 'regenerate_platform_metadata.sh', :platform => { :platform_path => "#{platform.path}/repository", :type => platform.distrib_type, :name => platform.name, :arch => 'x86_64' }, - :repository => {:id => platform.repositories.first.id}, - :type => :publish, :time_living => 9600, # 160 min :skip_feedback => true, :extra => {:platform_id => platform.id, :regenerate_platform => true} @@ -383,16 +384,16 @@ module AbfWorker 'publish_worker_default', 'class' => 'AbfWorker::PublishWorkerDefault', 'args' => [{ - :id => Time.now.to_i, - :cmd_params => cmd_params, + :id => Time.now.to_i, + :cmd_params => cmd_params, + :main_script => 'build.sh', + :rollback_script => 'rollback.sh', :platform => { :platform_path => "#{rep.platform.path}/repository", :type => build_for_platform.distrib_type, :name => build_for_platform.name, :arch => 'x86_64' }, - :repository => {:id => rep.id}, - :type => :publish, :time_living => 9600, # 160 min :skip_feedback => true, :extra => {:repository_status_id => repository_status.id, :regenerate => true} diff --git a/lib/abf_worker/publish_observer.rb b/lib/abf_worker/publish_observer.rb index 83ce48cb3..af7254e9c 100644 --- a/lib/abf_worker/publish_observer.rb +++ b/lib/abf_worker/publish_observer.rb @@ -9,18 +9,19 @@ module AbfWorker def perform 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 - if options['extra']['regenerate'] # Regenerate metadata + if extra['regenerate'] # Regenerate metadata repository_status.last_regenerated_at = Time.now.utc repository_status.last_regenerated_status = status - elsif options['extra']['regenerate_platform'] # Regenerate metadata for Software Center - if platform = Platform.where(:id => options['extra']['platform_id'])).first + elsif extra['regenerate_platform'] # Regenerate metadata for Software Center + if platform = Platform.where(:id => extra['platform_id'])).first platform.last_regenerated_at = Time.now.utc platform.last_regenerated_status = status platform.ready end - elsif options['extra']['create_container'] # Container has been created + elsif extra['create_container'] # Container has been created case status when COMPLETED subject.published_container @@ -28,7 +29,7 @@ module AbfWorker subject.fail_publish_container end update_results - else + elsif !extra['resign'] # Simple publish update_rpm_builds end ensure