add Stop action and time_living for building ISO
This commit is contained in:
parent
d2871afaff
commit
259eeaecfc
|
@ -14,6 +14,7 @@ class Platforms::ProductBuildListsController < Platforms::BaseController
|
||||||
product = @product_build_list.product
|
product = @product_build_list.product
|
||||||
@product_build_list.params = product.params
|
@product_build_list.params = product.params
|
||||||
@product_build_list.main_script = product.main_script
|
@product_build_list.main_script = product.main_script
|
||||||
|
@product_build_list.time_living = product.time_living
|
||||||
@product_build_list.project = product.project
|
@product_build_list.project = product.project
|
||||||
unless @product_build_list.project
|
unless @product_build_list.project
|
||||||
flash[:error] = t('flash.product_build_list.no_project')
|
flash[:error] = t('flash.product_build_list.no_project')
|
||||||
|
@ -24,13 +25,19 @@ class Platforms::ProductBuildListsController < Platforms::BaseController
|
||||||
def show
|
def show
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def stop
|
||||||
|
@product_build_list.stop
|
||||||
|
flash[:notice] = t('flash.product_build_list.will_be_stopped')
|
||||||
|
redirect_to platform_product_product_build_list_path(@platform, @product, @product_build_list)
|
||||||
|
end
|
||||||
|
|
||||||
def log
|
def log
|
||||||
@log = Resque.redis.get("abfworker::iso-worker-#{@product_build_list.id}") || ''
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.json {
|
format.json {
|
||||||
render :json => {
|
render :json => {
|
||||||
:log => @log,
|
:log => @product_build_list.log,
|
||||||
:building => @product_build_list.build_started? }
|
:building => @product_build_list.build_started?
|
||||||
|
}
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,7 +8,7 @@ class Product < ActiveRecord::Base
|
||||||
|
|
||||||
scope :recent, order("name ASC")
|
scope :recent, order("name ASC")
|
||||||
|
|
||||||
attr_accessible :name, :description, :project_id, :main_script, :params
|
attr_accessible :name, :description, :project_id, :main_script, :params, :time_living
|
||||||
attr_readonly :platform_id
|
attr_readonly :platform_id
|
||||||
|
|
||||||
def full_clone(attrs = {})
|
def full_clone(attrs = {})
|
||||||
|
|
|
@ -21,11 +21,15 @@ class ProductBuildList < ActiveRecord::Base
|
||||||
belongs_to :project
|
belongs_to :project
|
||||||
|
|
||||||
|
|
||||||
validates :product_id, :status, :project_id, :main_script, :presence => true
|
validates :product_id,
|
||||||
|
:status,
|
||||||
|
:project_id,
|
||||||
|
:main_script,
|
||||||
|
:time_living, :presence => true
|
||||||
validates :status, :inclusion => { :in => [BUILD_STARTED, BUILD_COMPLETED, BUILD_FAILED] }
|
validates :status, :inclusion => { :in => [BUILD_STARTED, BUILD_COMPLETED, BUILD_FAILED] }
|
||||||
|
|
||||||
attr_accessor :base_url
|
attr_accessor :base_url
|
||||||
attr_accessible :status, :base_url, :branch, :project_id, :main_script, :params, :project_version, :commit_hash
|
attr_accessible :status, :base_url, :branch, :project_id, :main_script, :params, :project_version, :commit_hash, :time_living
|
||||||
attr_readonly :product_id
|
attr_readonly :product_id
|
||||||
serialize :results, Array
|
serialize :results, Array
|
||||||
|
|
||||||
|
@ -64,6 +68,18 @@ class ProductBuildList < ActiveRecord::Base
|
||||||
[BUILD_COMPLETED, BUILD_FAILED].include? status
|
[BUILD_COMPLETED, BUILD_FAILED].include? status
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def log
|
||||||
|
Resque.redis.get("abfworker::iso-worker-#{id}") || ''
|
||||||
|
end
|
||||||
|
|
||||||
|
def stop
|
||||||
|
Resque.redis.setex(
|
||||||
|
"abfworker::iso-worker-#{id}::live-inspector",
|
||||||
|
60,
|
||||||
|
'USR1' # Immediately kill child but don't exit
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def xml_rpc_create
|
def xml_rpc_create
|
||||||
|
@ -81,6 +97,7 @@ class ProductBuildList < ActiveRecord::Base
|
||||||
# :srcpath => 'http://dl.dropbox.com/u/945501/avokhmin-test-iso-script-5d9b463d4e9c06ea8e7c89e1b7ff5cb37e99e27f.tar.gz',
|
# :srcpath => 'http://dl.dropbox.com/u/945501/avokhmin-test-iso-script-5d9b463d4e9c06ea8e7c89e1b7ff5cb37e99e27f.tar.gz',
|
||||||
:srcpath => srcpath,
|
:srcpath => srcpath,
|
||||||
:params => params,
|
:params => params,
|
||||||
|
:time_living => time_living,
|
||||||
:main_script => main_script
|
:main_script => main_script
|
||||||
}
|
}
|
||||||
Resque.push(
|
Resque.push(
|
||||||
|
|
|
@ -20,6 +20,10 @@
|
||||||
.rightlist= f.text_field :params
|
.rightlist= f.text_field :params
|
||||||
.both
|
.both
|
||||||
|
|
||||||
|
.leftlist= f.label :time_living, t("activerecord.attributes.product_build_list.time_living"), :class => :label
|
||||||
|
.rightlist= f.text_field :time_living
|
||||||
|
.both
|
||||||
|
|
||||||
= f.submit t("layout.projects.build_button")
|
= f.submit t("layout.projects.build_button")
|
||||||
|
|
||||||
%br
|
%br
|
||||||
|
|
|
@ -36,11 +36,18 @@
|
||||||
.rightlist= pbl.params
|
.rightlist= pbl.params
|
||||||
.both
|
.both
|
||||||
|
|
||||||
|
.leftlist= t("activerecord.attributes.product_build_list.time_living")
|
||||||
|
.rightlist= pbl.time_living
|
||||||
|
.both
|
||||||
|
|
||||||
.leftlist= t("activerecord.attributes.product_build_list.notified_at")
|
.leftlist= t("activerecord.attributes.product_build_list.notified_at")
|
||||||
.rightlist= l(pbl.updated_at, :format => :long)
|
.rightlist= l(pbl.updated_at, :format => :long)
|
||||||
.both
|
.both
|
||||||
|
|
||||||
- if pbl.build_started?
|
- if pbl.build_started?
|
||||||
|
.leftlist= t("layout.product_build_lists.action")
|
||||||
|
.rightlist= link_to t("layout.product_build_lists.stop"), stop_platform_product_product_build_list_path(pbl.product.platform, pbl.product, pbl)
|
||||||
|
.both
|
||||||
= render 'shared/log', { :build_started => true, :get_log_path => log_platform_product_product_build_list_path(pbl.product.platform, pbl.product, pbl) }
|
= render 'shared/log', { :build_started => true, :get_log_path => log_platform_product_product_build_list_path(pbl.product.platform, pbl.product, pbl) }
|
||||||
|
|
||||||
%h3= t("layout.product_build_lists.results")
|
%h3= t("layout.product_build_lists.results")
|
||||||
|
|
|
@ -18,6 +18,10 @@
|
||||||
.rightlist= f.text_field :params
|
.rightlist= f.text_field :params
|
||||||
.both
|
.both
|
||||||
|
|
||||||
|
.leftlist= f.label :time_living, t("activerecord.attributes.product_build_list.time_living"), :class => :label
|
||||||
|
.rightlist= f.text_field :time_living
|
||||||
|
.both
|
||||||
|
|
||||||
.button_block
|
.button_block
|
||||||
= submit_tag t("layout.save")
|
= submit_tag t("layout.save")
|
||||||
%span.text_button_padding= t("layout.or")
|
%span.text_button_padding= t("layout.or")
|
||||||
|
|
|
@ -8,6 +8,7 @@ en:
|
||||||
results_folder: all files from this folder will be uploaded into the file-store
|
results_folder: all files from this folder will be uploaded into the file-store
|
||||||
archives_folder: this folder will be archived and uploaded into the file-store
|
archives_folder: this folder will be archived and uploaded into the file-store
|
||||||
delete: Delete
|
delete: Delete
|
||||||
|
stop: Stop
|
||||||
action: Action
|
action: Action
|
||||||
id_search: 'Id search'
|
id_search: 'Id search'
|
||||||
new: New build
|
new: New build
|
||||||
|
@ -40,6 +41,7 @@ en:
|
||||||
project_version: Version
|
project_version: Version
|
||||||
main_script: Main script
|
main_script: Main script
|
||||||
params: Params for running script
|
params: Params for running script
|
||||||
|
time_living: Max time for building (in minutes)
|
||||||
product_build_list/results:
|
product_build_list/results:
|
||||||
file_name: File name
|
file_name: File name
|
||||||
sha1: SHA1
|
sha1: SHA1
|
||||||
|
@ -48,4 +50,5 @@ en:
|
||||||
product_build_list:
|
product_build_list:
|
||||||
no_project: Project for build should be exist
|
no_project: Project for build should be exist
|
||||||
delete: Product build list deleted
|
delete: Product build list deleted
|
||||||
delete_error: Unable to delete product build list
|
delete_error: Unable to delete product build list
|
||||||
|
will_be_stopped: Build will be stopped
|
|
@ -8,6 +8,7 @@ ru:
|
||||||
results_folder: все файлы из этой папки будут загружены на file-store
|
results_folder: все файлы из этой папки будут загружены на file-store
|
||||||
archives_folder: эта папка будет заархивирована и загружена на file-store
|
archives_folder: эта папка будет заархивирована и загружена на file-store
|
||||||
delete: Удалить
|
delete: Удалить
|
||||||
|
stop: Остановить
|
||||||
action: Действие
|
action: Действие
|
||||||
id_search: 'Поиск по Id'
|
id_search: 'Поиск по Id'
|
||||||
new: Новая сборка
|
new: Новая сборка
|
||||||
|
@ -40,6 +41,7 @@ ru:
|
||||||
project_version: Версия
|
project_version: Версия
|
||||||
main_script: Основной скрипт
|
main_script: Основной скрипт
|
||||||
params: Параметры для запуска скрипта
|
params: Параметры для запуска скрипта
|
||||||
|
time_living: Максимальное время сборки (в минутах)
|
||||||
product_build_list/results:
|
product_build_list/results:
|
||||||
file_name: Имя файла
|
file_name: Имя файла
|
||||||
sha1: SHA1
|
sha1: SHA1
|
||||||
|
@ -49,4 +51,4 @@ ru:
|
||||||
no_project: Проект для сборки должен присутствовать
|
no_project: Проект для сборки должен присутствовать
|
||||||
delete: Сборочный лист продукта удален
|
delete: Сборочный лист продукта удален
|
||||||
delete_error: Не удалось удалить cборочный лист продукта
|
delete_error: Не удалось удалить cборочный лист продукта
|
||||||
|
will_be_stopped: Сборка будет остановлена
|
||||||
|
|
|
@ -146,7 +146,10 @@ Rosa::Application.routes.draw do
|
||||||
resources :key_pairs, :only => [:create, :index, :destroy]
|
resources :key_pairs, :only => [:create, :index, :destroy]
|
||||||
resources :products do
|
resources :products do
|
||||||
resources :product_build_lists, :only => [:create, :destroy, :new, :show] do
|
resources :product_build_lists, :only => [:create, :destroy, :new, :show] do
|
||||||
member { get :log }
|
member {
|
||||||
|
get :log
|
||||||
|
get :stop
|
||||||
|
}
|
||||||
end
|
end
|
||||||
collection { get :autocomplete_project }
|
collection { get :autocomplete_project }
|
||||||
end
|
end
|
||||||
|
|
|
@ -24,6 +24,9 @@ class IntegrateNewIsoBuilderWithProducts < ActiveRecord::Migration
|
||||||
add_column :products, :main_script, :string
|
add_column :products, :main_script, :string
|
||||||
|
|
||||||
add_column :product_build_lists, :results, :text
|
add_column :product_build_lists, :results, :text
|
||||||
|
|
||||||
|
add_column :products, :time_living, :integer
|
||||||
|
add_column :product_build_lists, :time_living, :integer
|
||||||
end
|
end
|
||||||
|
|
||||||
def down
|
def down
|
||||||
|
@ -51,5 +54,8 @@ class IntegrateNewIsoBuilderWithProducts < ActiveRecord::Migration
|
||||||
remove_column :products, :main_script
|
remove_column :products, :main_script
|
||||||
|
|
||||||
remove_column :product_build_lists, :results
|
remove_column :product_build_lists, :results
|
||||||
|
|
||||||
|
remove_column :product_build_lists, :time_living
|
||||||
|
remove_column :products, :time_living
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -287,6 +287,7 @@ ActiveRecord::Schema.define(:version => 20121106113338) do
|
||||||
t.string "params"
|
t.string "params"
|
||||||
t.string "main_script"
|
t.string "main_script"
|
||||||
t.text "results"
|
t.text "results"
|
||||||
|
t.integer "time_living"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "product_build_lists", ["product_id"], :name => "index_product_build_lists_on_product_id"
|
add_index "product_build_lists", ["product_id"], :name => "index_product_build_lists_on_product_id"
|
||||||
|
@ -300,6 +301,7 @@ ActiveRecord::Schema.define(:version => 20121106113338) do
|
||||||
t.integer "project_id"
|
t.integer "project_id"
|
||||||
t.string "params"
|
t.string "params"
|
||||||
t.string "main_script"
|
t.string "main_script"
|
||||||
|
t.integer "time_living"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "project_imports", :force => true do |t|
|
create_table "project_imports", :force => true do |t|
|
||||||
|
|
Loading…
Reference in New Issue