#392: added use_extra_tests field to BuildList, MassBuild

This commit is contained in:
Vokhmin Alexey V 2014-05-24 00:29:24 +04:00
parent 5cafc7514b
commit 0c5e8c012c
15 changed files with 41 additions and 13 deletions

View File

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

View File

@ -71,7 +71,7 @@ class BuildList < ActiveRecord::Base
:save_to_platform_id, :project_version, :auto_create_container,
:extra_repositories, :extra_build_lists, :extra_params, :external_nodes,
:include_testing_subrepository, :auto_publish_status,
:use_cached_chroot
:use_cached_chroot, :use_extra_tests
LIVE_TIME = 4.week # for unpublished
MAX_LIVE_TIME = 3.month # for published
@ -531,6 +531,7 @@ class BuildList < ActiveRecord::Base
cmd_params = {
'GIT_PROJECT_ADDRESS' => git_project_address,
'COMMIT_HASH' => commit_hash,
'USE_EXTRA_TESTS' => use_extra_tests?,
'EXTRA_CFG_OPTIONS' => extra_params['cfg_options'],
'EXTRA_CFG_URPM_OPTIONS' => extra_params['cfg_urpm_options'],
'EXTRA_BUILD_SRC_RPM_OPTIONS' => extra_params['build_src_rpm'],

View File

@ -14,7 +14,7 @@ class MassBuild < ActiveRecord::Base
attr_accessor :arches
attr_accessible :arches, :auto_publish, :projects_list, :build_for_platform_id,
:extra_repositories, :extra_build_lists, :increase_release_tag,
:use_cached_chroot
:use_cached_chroot, :use_extra_tests
validates :save_to_platform_id,
:build_for_platform_id,
@ -30,6 +30,7 @@ class MassBuild < ActiveRecord::Base
validates :auto_publish,
:increase_release_tag,
:use_cached_chroot,
:use_extra_tests,
inclusion: { in: [true, false] }
after_commit :build_all, on: :create
@ -60,7 +61,7 @@ class MassBuild < ActiveRecord::Base
increase_rt = increase_release_tag?
arches_list.each do |arch|
rep_id = (project.repository_ids & save_to_platform.repository_ids).first
project.build_for(self, rep_id, arch, 0, increase_rt, use_cached_chroot)
project.build_for(self, rep_id, arch, 0, increase_rt)
increase_rt = false
end
rescue RuntimeError, Exception

View File

@ -167,7 +167,7 @@ class Project < ActiveRecord::Base
#path #share by NFS
end
def build_for(mass_build, repository_id, arch = Arch.find_by(name: 'i586'), priority = 0, increase_rt = false, use_cached_chroot = false)
def build_for(mass_build, repository_id, arch = Arch.find_by(name: 'i586'), priority = 0, increase_rt = false)
build_for_platform = mass_build.build_for_platform
save_to_platform = mass_build.save_to_platform
user = mass_build.user
@ -195,7 +195,8 @@ class Project < ActiveRecord::Base
bl.priority = priority
bl.mass_build_id = mass_build.id
bl.save_to_repository_id = repository_id
bl.use_cached_chroot = use_cached_chroot
bl.use_cached_chroot = mass_build.use_cached_chroot
bl.use_extra_tests = mass_build.use_extra_tests
end
build_list.save
end

View File

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

View File

@ -53,7 +53,7 @@
.toggle{id: "toggle_#{ mass_build.id }"}
= t('activerecord.attributes.mass_build.user') + ": "
= link_to mass_build.user.fullname, mass_build.user
- %i(arch_names auto_publish increase_release_tag use_cached_chroot created_at).each do |field|
- %i(arch_names auto_publish increase_release_tag use_cached_chroot use_extra_tests created_at).each do |field|
.both
= t("activerecord.attributes.mass_build.#{field}") + ": "
= mass_build.send field

View File

@ -40,7 +40,7 @@
subject: @mass_build,
autocomplete_path: autocomplete_extra_build_list_autocompletes_path
%h3= t("activerecord.attributes.build_list.preferences")
- %i(auto_publish increase_release_tag use_cached_chroot).each do |field|
- %i(auto_publish increase_release_tag use_cached_chroot use_extra_tests).each do |field|
.both
= f.check_box field
= f.label field

View File

@ -46,7 +46,7 @@
- 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.label :auto_publish_status
- %i(auto_create_container include_testing_subrepository use_cached_chroot).each do |kind|
- %i(auto_create_container include_testing_subrepository use_cached_chroot use_extra_tests).each do |kind|
.both
- checked = params[:build_list].try(:[], kind)
- checked = @build_list.send(kind) if checked.nil?

View File

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

View File

@ -11,6 +11,7 @@ en:
extra_build_lists: Extra build lists
auto_create_container: Create container automatically
use_cached_chroot: Use cached chroot
use_extra_tests: Use extra tests
container_path: Container path
status: Status
project_id: Project

View File

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

View File

@ -28,5 +28,6 @@ en:
auto_publish: Automated publishing
increase_release_tag: Increase release tag
use_cached_chroot: Use cached chroot
use_extra_tests: Use extra tests
repositories: Repositories
projects_list: Projects list

View File

@ -28,5 +28,6 @@ ru:
auto_publish: Автоматическая публикация
increase_release_tag: Увеличить release тег
use_cached_chroot: Использовать кэшированный chroot
use_extra_tests: Использовать дополнительные тесты
repositories: Репозитории
projects_list: Список проектов

View File

@ -0,0 +1,13 @@
class AddUseExtraTestsToBuildListsAndMassBuilds < ActiveRecord::Migration
def up
add_column :mass_builds, :use_extra_tests, :boolean, default: false, null: false
# Make existing build_lists 'false', but default to 'true' in the future.
add_column :build_lists, :use_extra_tests, :boolean, default: false, null: false
change_column :build_lists, :use_extra_tests, :boolean, default: true, null: false
end
def down
remove_column :mass_builds, :use_extra_tests
remove_column :build_lists, :use_extra_tests
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20140512183926) do
ActiveRecord::Schema.define(version: 20140523192643) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -141,6 +141,7 @@ ActiveRecord::Schema.define(version: 20140512183926) do
t.boolean "include_testing_subrepository"
t.string "auto_publish_status", default: "default", null: false
t.boolean "use_cached_chroot", default: false, null: false
t.boolean "use_extra_tests", default: true, null: false
t.index ["advisory_id"], :name => "index_build_lists_on_advisory_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"
@ -324,6 +325,7 @@ ActiveRecord::Schema.define(version: 20140512183926) do
t.text "extra_build_lists"
t.boolean "increase_release_tag", default: false, null: false
t.boolean "use_cached_chroot", default: true, null: false
t.boolean "use_extra_tests", default: false, null: false
end
create_table "users", force: true do |t|