Merge branch 'master' into 794-move-all-keys-into-abf-bd
This commit is contained in:
commit
f0b9d23bc2
|
@ -12,7 +12,8 @@ class Platforms::MassBuildsController < Platforms::BaseController
|
|||
def create
|
||||
mass_build = @platform.mass_builds.new(:arches => params[:arches],
|
||||
:auto_publish => params[:auto_publish] || false,
|
||||
:projects_list => params[:projects_list])
|
||||
:projects_list => params[:projects_list],
|
||||
:new_core => params[:new_core])
|
||||
mass_build.user = current_user
|
||||
authorize! :create, mass_build
|
||||
|
||||
|
|
|
@ -111,7 +111,8 @@ class Projects::PullRequestsController < Projects::BaseController
|
|||
|
||||
def autocomplete_to_project
|
||||
items = Project.accessible_by(current_ability, :membered) | @project.ancestors
|
||||
items.select! {|e| Regexp.new(params[:term].downcase).match(e.name_with_owner.downcase) && e.repo.branches.count > 0}
|
||||
term = Regexp.new(Regexp.escape params[:term].downcase)
|
||||
items.select! {|e| term.match(e.name_with_owner.downcase) && e.repo.branches.count > 0}
|
||||
render :json => json_for_autocomplete_base(items)
|
||||
end
|
||||
|
||||
|
|
|
@ -39,6 +39,9 @@ class BuildList < ActiveRecord::Base
|
|||
}
|
||||
}
|
||||
|
||||
attr_accessible :include_repos, :auto_publish, :build_for_platform_id, :commit_hash,
|
||||
:arch_id, :project_id, :save_to_repository_id, :update_type,
|
||||
:save_to_platform_id, :new_core, :project_version
|
||||
LIVE_TIME = 4.week # for unpublished
|
||||
MAX_LIVE_TIME = 3.month # for published
|
||||
|
||||
|
@ -265,7 +268,7 @@ class BuildList < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def publish_container
|
||||
type = save_to_platform.distrib_type
|
||||
type = build_for_platform.distrib_type
|
||||
archive = results.select{ |r| r['file_name'] =~ /.*\.tar\.gz$/}[0]
|
||||
|
||||
platform_path = "#{save_to_platform.path}/repository"
|
||||
|
|
|
@ -7,7 +7,7 @@ class MassBuild < ActiveRecord::Base
|
|||
scope :outdated, where('created_at < ?', Time.now + 1.day - BuildList::MAX_LIVE_TIME)
|
||||
|
||||
attr_accessor :arches
|
||||
attr_accessible :arches, :auto_publish, :projects_list
|
||||
attr_accessible :arches, :auto_publish, :projects_list, :new_core
|
||||
|
||||
validates :platform_id, :arch_names, :name, :user_id, :projects_list, :presence => true
|
||||
validates_inclusion_of :auto_publish, :in => [true, false]
|
||||
|
@ -38,7 +38,7 @@ class MassBuild < ActiveRecord::Base
|
|||
return if self.reload.stop_build
|
||||
arches_list.each do |arch|
|
||||
rep = (project.repositories & platform.repositories).first
|
||||
project.build_for(platform, rep.id, user, arch, auto_publish, self.id)
|
||||
project.build_for(platform, rep.id, user, arch, auto_publish, self.id, 0, new_core)
|
||||
end
|
||||
rescue RuntimeError, Exception
|
||||
end
|
||||
|
|
|
@ -63,7 +63,9 @@ class Platform < ActiveRecord::Base
|
|||
pair = blank_pair if pair.blank?
|
||||
urpmi_commands = ActiveSupport::OrderedHash.new
|
||||
|
||||
Platform.main.opened.where(:distrib_type => APP_CONFIG['distr_types'].first).each do |pl|
|
||||
# TODO: rename method or create separate methods for mdv and rhel
|
||||
# Platform.main.opened.where(:distrib_type => APP_CONFIG['distr_types'].first).each do |pl|
|
||||
Platform.main.opened.each do |pl|
|
||||
urpmi_commands[pl.name] = {}
|
||||
local_pair = pl.id != self.id ? blank_pair : pair
|
||||
head = hidden? ? "http://#{local_pair[:login]}@#{local_pair[:pass]}:#{host}/private/" : "http://#{host}/downloads/"
|
||||
|
@ -210,4 +212,4 @@ class Platform < ActiveRecord::Base
|
|||
repositories.update_all(:publish_without_qa => false)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -130,7 +130,7 @@ class Project < ActiveRecord::Base
|
|||
#path #share by NFS
|
||||
end
|
||||
|
||||
def build_for(platform, repository_id, user, arch = Arch.find_by_name('i586'), auto_publish = false, mass_build_id = nil, priority = 0)
|
||||
def build_for(platform, repository_id, user, arch = Arch.find_by_name('i586'), auto_publish = false, mass_build_id = nil, priority = 0, new_core = false)
|
||||
# Select main and project platform repository(contrib, non-free and etc)
|
||||
# If main does not exist, will connect only project platform repository
|
||||
# If project platform repository is main, only main will be connect
|
||||
|
@ -149,6 +149,7 @@ class Project < ActiveRecord::Base
|
|||
bl.priority = priority
|
||||
bl.mass_build_id = mass_build_id
|
||||
bl.save_to_repository_id = repository_id
|
||||
bl.new_core = new_core
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -16,8 +16,10 @@
|
|||
%h3= t("activerecord.attributes.build_list.preferences")
|
||||
.both.bottom_20
|
||||
= check_box_tag :auto_publish, true, @auto_publish_selected, :id => 'auto_publish'
|
||||
= label_tag :auto_publish
|
||||
|
||||
= label_tag :auto_publish, t('activerecord.attributes.build_list.auto_publish')
|
||||
%br
|
||||
= check_box_tag :new_core, true, false
|
||||
= label_tag :new_core, t('activerecord.attributes.build_list.new_core')
|
||||
%br
|
||||
%br
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class AddNewCoreToMassBuild < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :mass_builds, :new_core, :boolean, :default => false
|
||||
end
|
||||
end
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20121224125838) do
|
||||
ActiveRecord::Schema.define(:version => 20121225103309) do
|
||||
|
||||
create_table "activity_feeds", :force => true do |t|
|
||||
t.integer "user_id", :null => false
|
||||
|
@ -265,6 +265,7 @@ ActiveRecord::Schema.define(:version => 20121224125838) do
|
|||
t.text "projects_list"
|
||||
t.integer "missed_projects_count", :default => 0, :null => false
|
||||
t.text "missed_projects_list"
|
||||
t.boolean "new_core", :default => false
|
||||
end
|
||||
|
||||
create_table "platforms", :force => true do |t|
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace :build do
|
|||
open(source).readlines.each do |name|
|
||||
name.chomp!; name.strip! #; name.downcase!
|
||||
if p = Project.joins(:repositories).where('repositories.id IN (?)', platform.repositories).find_by_name(name)
|
||||
p.build_for(platform, owner, arch)
|
||||
# Old code p.build_for(platform, owner, arch)
|
||||
say "== Build #{p.name} =="
|
||||
else
|
||||
say "== Not found #{name} =="
|
||||
|
|
|
@ -98,7 +98,8 @@ describe Api::V1::BuildListsController do
|
|||
@build_list.save_to_platform.relations.create(:role => 'admin', :actor => @owner_user) # Why it's really need it??
|
||||
|
||||
# Create and show params:
|
||||
@create_params = {:build_list => @build_list.attributes.symbolize_keys.except(:bs_id)}
|
||||
@create_params = {:build_list => @build_list.attributes.symbolize_keys.except(:bs_id)
|
||||
.merge(:qwerty=>'!')} # wrong parameter
|
||||
@create_params = @create_params.merge(:arches => [@params[:arch_id]], :build_for_platforms => [@params[:build_for_platform_id]], :format => :json)
|
||||
any_instance_of(Project, :versions => ['v1.0', 'v2.0'])
|
||||
|
||||
|
|
|
@ -16,8 +16,8 @@ describe BuildList do
|
|||
|
||||
before(:all) { ActionMailer::Base.deliveries = [] }
|
||||
before do
|
||||
build_list.update_attributes(:commit_hash => build_list.project.repo.commits('master').last.id,
|
||||
:status => BuildServer::BUILD_STARTED,)
|
||||
build_list.update_attributes({:commit_hash => build_list.project.repo.commits('master').last.id,
|
||||
:status => BuildServer::BUILD_STARTED}, :without_protection => true)
|
||||
end
|
||||
after { ActionMailer::Base.deliveries = [] }
|
||||
|
||||
|
@ -39,25 +39,25 @@ describe BuildList do
|
|||
end
|
||||
|
||||
it "gets notification by email when status - Failed publish" do
|
||||
build_list.update_attributes(:status => BuildList::BUILD_PUBLISH)
|
||||
build_list.update_attributes({:status => BuildList::BUILD_PUBLISH}, :without_protection => true)
|
||||
build_list.fail_publish
|
||||
should have(1).item
|
||||
end
|
||||
|
||||
it "gets notification by email when auto_publish and status - Failed publish" do
|
||||
build_list.update_attributes(:auto_publish => true, :status => BuildList::BUILD_PUBLISH)
|
||||
build_list.update_attributes({:auto_publish => true, :status => BuildList::BUILD_PUBLISH}, :without_protection => true)
|
||||
build_list.fail_publish
|
||||
should have(1).item
|
||||
end
|
||||
|
||||
it "gets notification by email when status - Build published" do
|
||||
build_list.update_attributes(:status => BuildList::BUILD_PUBLISH)
|
||||
build_list.update_attributes({:status => BuildList::BUILD_PUBLISH}, :without_protection => true)
|
||||
build_list.published
|
||||
should have(1).item
|
||||
end
|
||||
|
||||
it "gets notification by email when auto_publish and status - Build published" do
|
||||
build_list.update_attributes(:auto_publish => true, :status => BuildList::BUILD_PUBLISH)
|
||||
build_list.update_attributes({:auto_publish => true, :status => BuildList::BUILD_PUBLISH}, :without_protection => true)
|
||||
build_list.published
|
||||
should have(1).item
|
||||
end
|
||||
|
@ -69,7 +69,7 @@ describe BuildList do
|
|||
end
|
||||
|
||||
it "doesn't get notification by email when mass build" do
|
||||
build_list.update_attributes(:mass_build_id => 1, :status => BuildList::BUILD_PUBLISH)
|
||||
build_list.update_attributes({:mass_build_id => 1, :status => BuildList::BUILD_PUBLISH}, :without_protection => true)
|
||||
build_list.published
|
||||
should have(:no).items
|
||||
end
|
||||
|
@ -133,8 +133,8 @@ describe BuildList do
|
|||
:auto_publish => true,
|
||||
:project => FactoryGirl.create(:project_with_commit, :owner => user))
|
||||
FactoryGirl.create(:build_list_package, :build_list => bl, :project => bl.project)
|
||||
bl.update_attributes(:commit_hash => bl.project.repo.commits('master').last.id,
|
||||
:status => BuildList::BUILD_PUBLISH)
|
||||
bl.update_attributes({:commit_hash => bl.project.repo.commits('master').last.id,
|
||||
:status => BuildList::BUILD_PUBLISH}, :without_protection => true)
|
||||
bl.published
|
||||
should have(1).item
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue