[refs #442] Merge master into 442-mass_build
This commit is contained in:
commit
dd9c653a90
|
@ -18,7 +18,7 @@ class BuildList < ActiveRecord::Base
|
|||
validates :update_type, :inclusion => UPDATE_TYPES,
|
||||
:unless => Proc.new { |b| b.save_to_platform.released }
|
||||
validates :update_type, :inclusion => RELEASE_UPDATE_TYPES,
|
||||
:if => Proc.new { |b| b.save_to_platform.released }
|
||||
:if => Proc.new { |b| b.save_to_platform.released && b.mass_build_id.nil?}
|
||||
validate lambda {
|
||||
errors.add(:build_for_platform, I18n.t('flash.build_list.wrong_platform')) if save_to_platform.platform_type == 'main' && save_to_platform_id != build_for_platform_id
|
||||
}
|
||||
|
@ -98,6 +98,7 @@ class BuildList < ActiveRecord::Base
|
|||
|
||||
before_create :set_default_status
|
||||
after_create :place_build
|
||||
after_destroy :delete_container
|
||||
|
||||
def self.human_status(status)
|
||||
I18n.t("layout.build_lists.statuses.#{HUMAN_STATUSES[status]}")
|
||||
|
@ -192,6 +193,15 @@ class BuildList < ActiveRecord::Base
|
|||
save
|
||||
end
|
||||
|
||||
|
||||
def delete_container
|
||||
if can_cancel?
|
||||
BuildServer.delete_build_list bs_id
|
||||
else
|
||||
BuildServer.delete_container bs_id if bs_id # prevent error if bs_id does not set
|
||||
end
|
||||
end
|
||||
|
||||
def build_package(pkg_hash, package_type, prj)
|
||||
packages.create(pkg_hash) do |p|
|
||||
p.project = prj
|
||||
|
|
|
@ -76,7 +76,7 @@ class Project < ActiveRecord::Base
|
|||
# If project platform repository is main, only main will be connect
|
||||
build_reps = [platform.repositories.find_by_name('main')]
|
||||
build_reps += platform.repositories.select {|rep| self.repository_ids.include? rep.id}
|
||||
build_ids = build_reps.compact.map(&:id).uniq
|
||||
build_reps_ids = build_reps.compact.map(&:id).uniq
|
||||
arch = Arch.find_by_name(arch) if arch.acts_like?(:string)
|
||||
build_lists.create do |bl|
|
||||
bl.save_to_platform = platform
|
||||
|
@ -86,8 +86,8 @@ class Project < ActiveRecord::Base
|
|||
bl.project_version = "latest_#{platform.name}"
|
||||
bl.build_requires = false # already set as db default
|
||||
bl.user = user
|
||||
bl.auto_publish = auto_publish # already set as db default
|
||||
bl.include_repos = build_ids
|
||||
bl.auto_publish = auto_publish
|
||||
bl.include_repos = build_reps_ids
|
||||
bl.priority = priority
|
||||
bl.mass_build_id = mass_build_id
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue