add selecting Arch on create product build

This commit is contained in:
Vokhmin Alexey V 2012-11-13 18:01:06 +04:00
parent abbbacdf7f
commit f522fd3cd0
9 changed files with 21 additions and 5 deletions

View File

@ -19,13 +19,15 @@ class ProductBuildList < ActiveRecord::Base
belongs_to :product
belongs_to :project
belongs_to :arch
validates :product_id,
:status,
:project_id,
:main_script,
:time_living, :presence => true
:time_living,
:arch_id, :presence => true
validates :status, :inclusion => { :in => [BUILD_STARTED, BUILD_COMPLETED, BUILD_FAILED] }
attr_accessor :base_url
@ -37,7 +39,8 @@ class ProductBuildList < ActiveRecord::Base
:params,
:project_version,
:commit_hash,
:time_living
:time_living,
:arch_id
attr_readonly :product_id
serialize :results, Array
@ -106,7 +109,9 @@ class ProductBuildList < ActiveRecord::Base
:srcpath => srcpath,
:params => params,
:time_living => time_living,
:main_script => main_script
:main_script => main_script,
:arch => arch.name,
:distrib_type => product.platform.distrib_type
}
Resque.push(
'iso_worker',

View File

@ -12,6 +12,10 @@
.rightlist= f.select :project_version, versions_for_group_select(pbl.project), :selected => params[:product_build_lists].try(:fetch, :project_version) || "latest_" + pbl.project.default_branch
.both
.leftlist= f.label :arch, t("activerecord.attributes.product_build_list.arch"), :class => :label
.rightlist= f.select :arch_id, Arch.recent.map{ |a| [a.name, a.id]}
.both
= render 'platforms/products/def_fields', :f => f
= f.submit t("layout.projects.build_button")

View File

@ -17,7 +17,7 @@
= render 'show_field', :key => :project_version, :value => build_list_version_link(pbl, true)
- [:main_script, :params, :time_living].each do |el|
- [:arch, :main_script, :params, :time_living].each do |el|
= render 'show_field', :key => el, :value => pbl.send(el)
= render 'show_field', :key => :notified_at, :value => l(pbl.updated_at, :format => :long)

View File

@ -42,6 +42,7 @@ en:
main_script: Main script
params: Params for running script
time_living: Max time for building (in minutes)
arch: Arch
product_build_list/results:
file_name: File name
sha1: SHA1

View File

@ -42,6 +42,7 @@ ru:
main_script: Основной скрипт
params: Параметры для запуска скрипта
time_living: Максимальное время сборки (в минутах)
arch: Архитектура
product_build_list/results:
file_name: Имя файла
sha1: SHA1

View File

@ -24,6 +24,7 @@ class IntegrateNewIsoBuilderWithProducts < ActiveRecord::Migration
add_column :products, :main_script, :string
add_column :product_build_lists, :results, :text
add_column :product_build_lists, :arch_id, :integer
add_column :products, :time_living, :integer
add_column :product_build_lists, :time_living, :integer
@ -54,6 +55,7 @@ class IntegrateNewIsoBuilderWithProducts < ActiveRecord::Migration
remove_column :products, :main_script
remove_column :product_build_lists, :results
remove_column :product_build_lists, :arch_id
remove_column :product_build_lists, :time_living
remove_column :products, :time_living

View File

@ -287,6 +287,7 @@ ActiveRecord::Schema.define(:version => 20121106113338) do
t.string "params"
t.string "main_script"
t.text "results"
t.integer "arch_id"
t.integer "time_living"
end

View File

@ -88,11 +88,12 @@ describe Platforms::ProductBuildListsController do
before(:each) do
@product = FactoryGirl.create(:product)
@arch = FactoryGirl.create(:arch)
@pbl = FactoryGirl.create(:product_build_list, :product => @product)
end
def valid_attributes
{:product_id => @product.id, :platform_id => @product.platform_id, :product_build_list => {:main_script => 'build.sh', :time_living => 60, :project_version => 'latest_master'}}
{:product_id => @product.id, :platform_id => @product.platform_id, :product_build_list => {:main_script => 'build.sh', :time_living => 60, :project_version => 'latest_master', :arch_id => @arch.id}}
end
def valid_attributes_for_destroy

View File

@ -2,6 +2,7 @@
FactoryGirl.define do
factory :product_build_list do
association :product, :factory => :product
association :arch, :factory => :arch
project { |pbl| pbl.product.project }
status 0 # BUILD_COMPLETED
main_script 'build.sh'