added IsoWorkerObserver
This commit is contained in:
parent
4595ce349c
commit
3d293b908d
|
@ -2,7 +2,6 @@
|
|||
class ProductBuildList < ActiveRecord::Base
|
||||
include Modules::Models::CommitAndVersion
|
||||
delegate :url_helpers, to: 'Rails.application.routes'
|
||||
# include Rails.application.routes.url_helpers
|
||||
|
||||
BUILD_STARTED = 2
|
||||
BUILD_COMPLETED = 0
|
||||
|
@ -28,6 +27,7 @@ class ProductBuildList < ActiveRecord::Base
|
|||
attr_accessor :base_url
|
||||
attr_accessible :status, :base_url, :branch, :project_id, :main_script, :params, :project_version, :commit_hash
|
||||
attr_readonly :product_id
|
||||
serialize :results, Array
|
||||
|
||||
|
||||
scope :default_order, order('updated_at DESC')
|
||||
|
@ -80,11 +80,18 @@ class ProductBuildList < ActiveRecord::Base
|
|||
:main_script => main_script
|
||||
}
|
||||
# if result == ProductBuilder::SUCCESS
|
||||
if Resque.enqueue(AbfWorker::IsoWorker, options)
|
||||
return true
|
||||
else
|
||||
raise "Failed to create product_build_list #{id} inside platform #{product.platform.name} with params: #{options.inspect}"
|
||||
end
|
||||
|
||||
Resque.push(
|
||||
'iso_worker',
|
||||
'class' => 'AbfWorker::IsoWorker',
|
||||
'args' => [options]
|
||||
)
|
||||
return true
|
||||
# if Resque.enqueue(AbfWorker::IsoWorker, options)
|
||||
# return true
|
||||
# else
|
||||
# raise "Failed to create product_build_list #{id} inside platform #{product.platform.name} with params: #{options.inspect}"
|
||||
# end
|
||||
end
|
||||
|
||||
def xml_delete_iso_container
|
||||
|
|
|
@ -47,5 +47,25 @@
|
|||
.rightlist= l(pbl.updated_at, :format => :long)
|
||||
.both
|
||||
|
||||
%h3= t("layout.product_build_lists.results")
|
||||
- unless pbl.results.present?
|
||||
%h4.nomargin= t("layout.product_build_lists.no_results")
|
||||
- else
|
||||
%table.tablesorter.width565{:cellpadding => "0", :cellspacing => "0"}
|
||||
%thead
|
||||
%tr
|
||||
%th= t("activerecord.attributes.product_build_list/results.file_name")
|
||||
%th= t("activerecord.attributes.product_build_list/results.sha1")
|
||||
%th= t("activerecord.attributes.product_build_list/results.link")
|
||||
%tbody
|
||||
- pbl.results.each do |item|
|
||||
%tr
|
||||
%td= item['file_name']
|
||||
- sha1 = item['sha1']
|
||||
%td= sha1
|
||||
%td= link_to t("activerecord.attributes.product_build_list/results.link"), "http://file-store.rosalinux.ru/api/v1/file_stores/#{sha1}"
|
||||
.both
|
||||
|
||||
|
||||
:javascript
|
||||
$('article .all').addClass('bigpadding');
|
|
@ -1,6 +1,7 @@
|
|||
en:
|
||||
layout:
|
||||
product_build_lists:
|
||||
results: Results
|
||||
work_env: Work environment
|
||||
iso_builder_folder: folder with contents of the GIT project
|
||||
results_folder: all files from this folder will be uploaded into the file-store
|
||||
|
@ -38,6 +39,10 @@ en:
|
|||
project_version: Version
|
||||
main_script: Main script
|
||||
params: Params for running script
|
||||
product_build_list/results:
|
||||
file_name: File name
|
||||
sha1: SHA1
|
||||
link: Link
|
||||
|
||||
flash:
|
||||
product_build_list:
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
ru:
|
||||
layout:
|
||||
product_build_lists:
|
||||
results: Результаты
|
||||
work_env: Рабочее пространство
|
||||
iso_builder_folder: папка с содержимым GIT проекта
|
||||
results_folder: все файлы из этой папки будут загружены на file-store
|
||||
|
@ -38,6 +39,10 @@ ru:
|
|||
project_version: Версия
|
||||
main_script: Основной скрипт
|
||||
params: Параметры для запуска скрипта
|
||||
product_build_list/results:
|
||||
file_name: Имя файла
|
||||
sha1: SHA1
|
||||
link: Ссылка
|
||||
|
||||
flash:
|
||||
product_build_list:
|
||||
|
|
|
@ -19,6 +19,7 @@ class IntegrateNewIsoBuilderWithProducts < ActiveRecord::Migration
|
|||
|
||||
add_column :product_build_lists, :params, :string
|
||||
add_column :product_build_lists, :main_script, :string
|
||||
add_column :product_build_lists, :results, :text
|
||||
end
|
||||
|
||||
def down
|
||||
|
@ -41,5 +42,6 @@ class IntegrateNewIsoBuilderWithProducts < ActiveRecord::Migration
|
|||
|
||||
remove_column :product_build_lists, :params
|
||||
remove_column :product_build_lists, :main_script
|
||||
remove_column :product_build_lists, :results
|
||||
end
|
||||
end
|
||||
|
|
|
@ -286,6 +286,7 @@ ActiveRecord::Schema.define(:version => 20121106113338) do
|
|||
t.string "commit_hash"
|
||||
t.string "params"
|
||||
t.string "main_script"
|
||||
t.text "results"
|
||||
end
|
||||
|
||||
add_index "product_build_lists", ["product_id"], :name => "index_product_build_lists_on_product_id"
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
module AbfWorker
|
||||
class IsoWorker
|
||||
@queue = :iso_worker
|
||||
end
|
||||
end
|
|
@ -0,0 +1,14 @@
|
|||
module AbfWorker
|
||||
class IsoWorkerObserver
|
||||
@queue = :iso_worker_observer
|
||||
|
||||
def self.perform(options)
|
||||
status = options['status'].to_i
|
||||
pbl = ProductBuildList.find options['id']
|
||||
pbl.status = status
|
||||
pbl.results = options['results'] if status != ProductBuildList::BUILD_STARTED
|
||||
pbl.save!
|
||||
end
|
||||
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue