Added ability to use external nodes for run mass-builds

This commit is contained in:
Vokhmin Alexey V 2014-10-15 23:54:15 +04:00
parent d4f6552bf7
commit bdc0e29bff
8 changed files with 26 additions and 2 deletions

View File

@ -1,6 +1,7 @@
class MassBuild < ActiveRecord::Base class MassBuild < ActiveRecord::Base
AUTO_PUBLISH_STATUSES = %w(none default testing) AUTO_PUBLISH_STATUSES = %w(none default testing)
EXTERNAL_NODES = %w(owned everything)
STATUSES, HUMAN_STATUSES = [], {} STATUSES, HUMAN_STATUSES = [], {}
[ [
@ -47,7 +48,7 @@ class MassBuild < ActiveRecord::Base
attr_accessible :arches, :auto_publish_status, :projects_list, :build_for_platform_id, attr_accessible :arches, :auto_publish_status, :projects_list, :build_for_platform_id,
:extra_repositories, :extra_build_lists, :increase_release_tag, :extra_repositories, :extra_build_lists, :increase_release_tag,
:use_cached_chroot, :use_extra_tests, :description, :extra_mass_builds, :use_cached_chroot, :use_extra_tests, :description, :extra_mass_builds,
:include_testing_subrepository, :auto_create_container :include_testing_subrepository, :auto_create_container, :external_nodes
validates :save_to_platform_id, validates :save_to_platform_id,
:build_for_platform_id, :build_for_platform_id,
@ -56,6 +57,10 @@ class MassBuild < ActiveRecord::Base
:user_id, :user_id,
presence: true presence: true
validates :external_nodes,
inclusion: { in: EXTERNAL_NODES },
allow_blank: true
validates :projects_list, validates :projects_list,
presence: true, presence: true,
length: { maximum: 500_000 } length: { maximum: 500_000 }

View File

@ -199,6 +199,7 @@ class Project < ActiveRecord::Base
bl.include_testing_subrepository = mass_build.include_testing_subrepository? bl.include_testing_subrepository = mass_build.include_testing_subrepository?
bl.use_cached_chroot = mass_build.use_cached_chroot? bl.use_cached_chroot = mass_build.use_cached_chroot?
bl.use_extra_tests = mass_build.use_extra_tests? bl.use_extra_tests = mass_build.use_extra_tests?
bl.external_nodes = mass_build.external_nodes
end end
build_list.save build_list.save
end end

View File

@ -56,4 +56,9 @@
.both .both
= f.check_box field = f.check_box field
= f.label field = f.label field
.both
= f.select :external_nodes, external_nodes, include_blank: true
= f.label :external_nodes
.both .both

View File

@ -22,6 +22,11 @@
%td %td
%b= t('activerecord.attributes.mass_build.build_for_platform') %b= t('activerecord.attributes.mass_build.build_for_platform')
%td= link_to @mass_build.build_for_platform.name, platform_path(@mass_build.build_for_platform) %td= link_to @mass_build.build_for_platform.name, platform_path(@mass_build.build_for_platform)
- if @mass_build.external_nodes.present?
%tr
%td
%b= t('activerecord.attributes.build_list.external_nodes')
%td= I18n.t("layout.build_lists.external_nodes.#{@mass_build.external_nodes}")
%tr %tr
%td %td
%b= t('activerecord.attributes.mass_build.auto_publish_status') %b= t('activerecord.attributes.mass_build.auto_publish_status')

View File

@ -40,3 +40,4 @@ en:
repositories: Repositories repositories: Repositories
projects_list: Projects list projects_list: Projects list
build_for_platform: Build for platform build_for_platform: Build for platform
external_nodes: External nodes

View File

@ -41,3 +41,4 @@ ru:
repositories: Репозитории repositories: Репозитории
projects_list: Список проектов projects_list: Список проектов
build_for_platform: Собрано для платформы build_for_platform: Собрано для платформы
external_nodes: Дополнительные ноды

View File

@ -0,0 +1,5 @@
class AddExternalNodesToMassBuilds < ActiveRecord::Migration
def change
add_column :mass_builds, :external_nodes, :string
end
end

View File

@ -11,7 +11,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20141006182907) do ActiveRecord::Schema.define(version: 20141015193923) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
@ -333,6 +333,7 @@ ActiveRecord::Schema.define(version: 20141006182907) do
t.boolean "include_testing_subrepository", default: false, null: false t.boolean "include_testing_subrepository", default: false, null: false
t.boolean "auto_create_container", default: false, null: false t.boolean "auto_create_container", default: false, null: false
t.integer "status", default: 2000, null: false t.integer "status", default: 2000, null: false
t.string "external_nodes"
end end
create_table "users", force: true do |t| create_table "users", force: true do |t|