From bdc0e29bffbc189c44f03ec00974a7d1b6b2993a Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Wed, 15 Oct 2014 23:54:15 +0400 Subject: [PATCH] Added ability to use external nodes for run mass-builds --- app/models/mass_build.rb | 7 ++++++- app/models/project.rb | 1 + app/views/platforms/mass_builds/new.html.haml | 5 +++++ app/views/platforms/mass_builds/show.html.haml | 5 +++++ config/locales/models/mass_build.en.yml | 1 + config/locales/models/mass_build.ru.yml | 1 + .../20141015193923_add_external_nodes_to_mass_builds.rb | 5 +++++ db/schema.rb | 3 ++- 8 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20141015193923_add_external_nodes_to_mass_builds.rb diff --git a/app/models/mass_build.rb b/app/models/mass_build.rb index bca7ee22e..e76edef72 100644 --- a/app/models/mass_build.rb +++ b/app/models/mass_build.rb @@ -1,6 +1,7 @@ class MassBuild < ActiveRecord::Base AUTO_PUBLISH_STATUSES = %w(none default testing) + EXTERNAL_NODES = %w(owned everything) STATUSES, HUMAN_STATUSES = [], {} [ @@ -47,7 +48,7 @@ class MassBuild < ActiveRecord::Base attr_accessible :arches, :auto_publish_status, :projects_list, :build_for_platform_id, :extra_repositories, :extra_build_lists, :increase_release_tag, :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, :build_for_platform_id, @@ -56,6 +57,10 @@ class MassBuild < ActiveRecord::Base :user_id, presence: true + validates :external_nodes, + inclusion: { in: EXTERNAL_NODES }, + allow_blank: true + validates :projects_list, presence: true, length: { maximum: 500_000 } diff --git a/app/models/project.rb b/app/models/project.rb index 73e3e94b3..d0ed6fa86 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -199,6 +199,7 @@ class Project < ActiveRecord::Base bl.include_testing_subrepository = mass_build.include_testing_subrepository? bl.use_cached_chroot = mass_build.use_cached_chroot? bl.use_extra_tests = mass_build.use_extra_tests? + bl.external_nodes = mass_build.external_nodes end build_list.save end diff --git a/app/views/platforms/mass_builds/new.html.haml b/app/views/platforms/mass_builds/new.html.haml index d4be8ee51..91f13db07 100644 --- a/app/views/platforms/mass_builds/new.html.haml +++ b/app/views/platforms/mass_builds/new.html.haml @@ -56,4 +56,9 @@ .both = f.check_box field = f.label field + + .both + = f.select :external_nodes, external_nodes, include_blank: true + = f.label :external_nodes + .both diff --git a/app/views/platforms/mass_builds/show.html.haml b/app/views/platforms/mass_builds/show.html.haml index 6b5f5bbcd..dfba732d2 100644 --- a/app/views/platforms/mass_builds/show.html.haml +++ b/app/views/platforms/mass_builds/show.html.haml @@ -22,6 +22,11 @@ %td %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) + - 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 %td %b= t('activerecord.attributes.mass_build.auto_publish_status') diff --git a/config/locales/models/mass_build.en.yml b/config/locales/models/mass_build.en.yml index f7ad88208..ed2997262 100644 --- a/config/locales/models/mass_build.en.yml +++ b/config/locales/models/mass_build.en.yml @@ -40,3 +40,4 @@ en: repositories: Repositories projects_list: Projects list build_for_platform: Build for platform + external_nodes: External nodes diff --git a/config/locales/models/mass_build.ru.yml b/config/locales/models/mass_build.ru.yml index 33084f8cc..927081764 100644 --- a/config/locales/models/mass_build.ru.yml +++ b/config/locales/models/mass_build.ru.yml @@ -41,3 +41,4 @@ ru: repositories: Репозитории projects_list: Список проектов build_for_platform: Собрано для платформы + external_nodes: Дополнительные ноды diff --git a/db/migrate/20141015193923_add_external_nodes_to_mass_builds.rb b/db/migrate/20141015193923_add_external_nodes_to_mass_builds.rb new file mode 100644 index 000000000..70a13c1ea --- /dev/null +++ b/db/migrate/20141015193923_add_external_nodes_to_mass_builds.rb @@ -0,0 +1,5 @@ +class AddExternalNodesToMassBuilds < ActiveRecord::Migration + def change + add_column :mass_builds, :external_nodes, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index ad6657b54..e93e250ca 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # 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 enable_extension "plpgsql" @@ -333,6 +333,7 @@ ActiveRecord::Schema.define(version: 20141006182907) do t.boolean "include_testing_subrepository", default: false, null: false t.boolean "auto_create_container", default: false, null: false t.integer "status", default: 2000, null: false + t.string "external_nodes" end create_table "users", force: true do |t|