#373: added use_cached_chroot field

This commit is contained in:
Vokhmin Alexey V 2014-04-07 23:00:42 +04:00
parent 62e7c9a5e5
commit c41fc4d0bb
9 changed files with 35 additions and 12 deletions

View File

@ -190,12 +190,12 @@ class Projects::BuildListsController < Projects::BaseController
def create_from_build_list def create_from_build_list
return if params[:build_list_id].blank? return if params[:build_list_id].blank?
build_list = BuildList.find(params[:build_list_id]) @build_list = @project.build_lists.find(params[:build_list_id])
params[:build_list] ||= {} params[:build_list] ||= {}
keys = [:save_to_repository_id, :auto_publish_status, :include_repos, :extra_params, keys = [:save_to_repository_id, :auto_publish_status, :include_repos, :extra_params,
:project_version, :update_type, :auto_create_container, :project_version, :update_type, :auto_create_container,
:extra_repositories, :extra_build_lists, :build_for_platform_id] :extra_repositories, :extra_build_lists, :build_for_platform_id, :use_cached_chroot]
keys.each { |key| params[:build_list][key] = build_list.send(key) } keys.each { |key| params[:build_list][key] = build_list.send(key) }
params[:arches] = [build_list.arch_id.to_s] params[:arches] = [build_list.arch_id.to_s]
[:owner_filter, :status_filter].each { |t| params[t] = 'true' if %w(true undefined).exclude? params[t] } [:owner_filter, :status_filter].each { |t| params[t] = 'true' if %w(true undefined).exclude? params[t] }

View File

@ -30,8 +30,15 @@ class BuildList < ActiveRecord::Base
AUTO_PUBLISH_STATUS_TESTING = 'testing' AUTO_PUBLISH_STATUS_TESTING = 'testing'
AUTO_PUBLISH_STATUSES = [AUTO_PUBLISH_STATUS_NONE, AUTO_PUBLISH_STATUS_DEFAULT, AUTO_PUBLISH_STATUS_TESTING] AUTO_PUBLISH_STATUSES = [AUTO_PUBLISH_STATUS_NONE, AUTO_PUBLISH_STATUS_DEFAULT, AUTO_PUBLISH_STATUS_TESTING]
validates :project_id, :project_version, :arch, :include_repos, validates :project_id,
:build_for_platform_id, :save_to_platform_id, :save_to_repository_id, presence: true :project_version,
:arch,
:include_repos,
:build_for_platform_id,
:save_to_platform_id,
:use_cached_chroot,
:save_to_repository_id,
presence: true
validates_numericality_of :priority, greater_than_or_equal_to: 0 validates_numericality_of :priority, greater_than_or_equal_to: 0
validates :external_nodes, inclusion: { in: EXTERNAL_NODES }, allow_blank: true validates :external_nodes, inclusion: { in: EXTERNAL_NODES }, allow_blank: true
validates :auto_publish_status, inclusion: { in: AUTO_PUBLISH_STATUSES } validates :auto_publish_status, inclusion: { in: AUTO_PUBLISH_STATUSES }
@ -64,7 +71,8 @@ class BuildList < ActiveRecord::Base
:arch_id, :project_id, :save_to_repository_id, :update_type, :arch_id, :project_id, :save_to_repository_id, :update_type,
:save_to_platform_id, :project_version, :auto_create_container, :save_to_platform_id, :project_version, :auto_create_container,
:extra_repositories, :extra_build_lists, :extra_params, :external_nodes, :extra_repositories, :extra_build_lists, :extra_params, :external_nodes,
:include_testing_subrepository, :auto_publish_status :include_testing_subrepository, :auto_publish_status,
:use_cached_chroot
LIVE_TIME = 4.week # for unpublished LIVE_TIME = 4.week # for unpublished
MAX_LIVE_TIME = 3.month # for published MAX_LIVE_TIME = 3.month # for published
@ -508,6 +516,7 @@ class BuildList < ActiveRecord::Base
cmd_params = { cmd_params = {
'GIT_PROJECT_ADDRESS' => git_project_address, 'GIT_PROJECT_ADDRESS' => git_project_address,
'COMMIT_HASH' => commit_hash, 'COMMIT_HASH' => commit_hash,
'USE_CACHED_CHROOT' => use_cached_chroot?,
'EXTRA_CFG_OPTIONS' => extra_params['cfg_options'], 'EXTRA_CFG_OPTIONS' => extra_params['cfg_options'],
'EXTRA_CFG_URPM_OPTIONS' => extra_params['cfg_urpm_options'], 'EXTRA_CFG_URPM_OPTIONS' => extra_params['cfg_urpm_options'],
'EXTRA_BUILD_SRC_RPM_OPTIONS' => extra_params['build_src_rpm'], 'EXTRA_BUILD_SRC_RPM_OPTIONS' => extra_params['build_src_rpm'],

View File

@ -2,7 +2,7 @@ json.build_list do
json.(@build_list, :id, :container_status, :status, :duration) json.(@build_list, :id, :container_status, :status, :duration)
json.(@build_list, :update_type, :priority, :new_core) json.(@build_list, :update_type, :priority, :new_core)
json.(@build_list, :advisory, :mass_build) json.(@build_list, :advisory, :mass_build)
json.(@build_list, :auto_publish_status, :package_version, :commit_hash, :last_published_commit_hash, :auto_create_container) json.(@build_list, :auto_publish_status, :package_version, :commit_hash, :last_published_commit_hash, :auto_create_container, :use_cached_chroot)
json.build_log_url log_build_list_path(@build_list) json.build_log_url log_build_list_path(@build_list)
if @build_list.container_published? if @build_list.container_published?

View File

@ -46,12 +46,9 @@
- selected = params[:build_list].try(:[], :auto_publish_status) ? {selected: params[:build_list][:auto_publish_status]} : {} - selected = params[:build_list].try(:[], :auto_publish_status) ? {selected: params[:build_list][:auto_publish_status]} : {}
= f.select :auto_publish_status, auto_publish_statuses, selected = f.select :auto_publish_status, auto_publish_statuses, selected
= f.label :auto_publish_status = f.label :auto_publish_status
.both - %i(auto_create_container include_testing_subrepository use_cached_chroot).each do |kind|
- %i(auto_create_container include_testing_subrepository).each do |kind|
.both .both
- checked, field = params[:build_list].try(:[], kind), "build_list[#{kind}]" = f.check_box kind
= hidden_field_tag field, false, id: nil
= check_box_tag field, true, checked
= f.label kind = f.label kind
.both .both
- selected = params[:build_list].try(:[], :external_nodes) ? {selected: params[:build_list][:external_nodes]} : {} - selected = params[:build_list].try(:[], :external_nodes) ? {selected: params[:build_list][:external_nodes]} : {}

View File

@ -63,6 +63,9 @@
.leftlist= t("activerecord.attributes.build_list.auto_create_container") .leftlist= t("activerecord.attributes.build_list.auto_create_container")
.rightlist= t("layout.#{@build_list.auto_create_container?}_") .rightlist= t("layout.#{@build_list.auto_create_container?}_")
.both .both
.leftlist= t("activerecord.attributes.build_list.use_cached_chroot")
.rightlist= t("layout.#{@build_list.use_cached_chroot?}_")
.both
.leftlist= t("activerecord.attributes.build_list.project_version") .leftlist= t("activerecord.attributes.build_list.project_version")
.rightlist= link_to @build_list.project_version, tree_path(@build_list.project, @build_list.project_version) .rightlist= link_to @build_list.project_version, tree_path(@build_list.project, @build_list.project_version)
.both .both

View File

@ -10,6 +10,7 @@ en:
extra_repositories: Extra repositories extra_repositories: Extra repositories
extra_build_lists: Extra build lists extra_build_lists: Extra build lists
auto_create_container: Create container automatically auto_create_container: Create container automatically
use_cached_chroot: Use cached chroot
container_path: Container path container_path: Container path
status: Status status: Status
project_id: Project project_id: Project

View File

@ -10,6 +10,7 @@ ru:
extra_repositories: Дополнительные репозитории extra_repositories: Дополнительные репозитории
extra_build_lists: Дополнительные сборки extra_build_lists: Дополнительные сборки
auto_create_container: Создать контейнер автоматически auto_create_container: Создать контейнер автоматически
use_cached_chroot: Использовать кэшированный chroot
container_path: Путь до контейнера container_path: Путь до контейнера
status: Статус status: Статус
project_id: Проект project_id: Проект

View File

@ -0,0 +1,11 @@
class AddUseCachedChrootToBuildList < ActiveRecord::Migration
def change
# Make existing build_lists 'false', but default to 'true' in the future.
add_column :build_lists, :use_cached_chroot, :boolean, null: false, default: false
change_column :build_lists, :use_cached_chroot, :boolean, null: false, default: true
end
def down
remove_column :build_lists, :use_cached_chroot
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: 20140306102620) do ActiveRecord::Schema.define(version: 20140407181059) 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"
@ -140,6 +140,7 @@ ActiveRecord::Schema.define(version: 20140306102620) do
t.integer "builder_id" t.integer "builder_id"
t.boolean "include_testing_subrepository" t.boolean "include_testing_subrepository"
t.string "auto_publish_status", default: "default", null: false t.string "auto_publish_status", default: "default", null: false
t.boolean "use_cached_chroot", default: true, null: false
t.index ["advisory_id"], :name => "index_build_lists_on_advisory_id" t.index ["advisory_id"], :name => "index_build_lists_on_advisory_id"
t.index ["arch_id"], :name => "index_build_lists_on_arch_id" t.index ["arch_id"], :name => "index_build_lists_on_arch_id"
t.index ["mass_build_id", "status"], :name => "index_build_lists_on_mass_build_id_and_status" t.index ["mass_build_id", "status"], :name => "index_build_lists_on_mass_build_id_and_status"