Merge pull request #498 from warpc/430-delete_old_bs
[refs #430] Delete containers after deleting build list
This commit is contained in:
commit
bfdf81c377
|
@ -98,6 +98,7 @@ class BuildList < ActiveRecord::Base
|
||||||
|
|
||||||
before_create :set_default_status
|
before_create :set_default_status
|
||||||
after_create :place_build
|
after_create :place_build
|
||||||
|
after_destroy :delete_container
|
||||||
|
|
||||||
def self.human_status(status)
|
def self.human_status(status)
|
||||||
I18n.t("layout.build_lists.statuses.#{HUMAN_STATUSES[status]}")
|
I18n.t("layout.build_lists.statuses.#{HUMAN_STATUSES[status]}")
|
||||||
|
@ -192,6 +193,15 @@ class BuildList < ActiveRecord::Base
|
||||||
save
|
save
|
||||||
end
|
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)
|
def build_package(pkg_hash, package_type, prj)
|
||||||
packages.create(pkg_hash) do |p|
|
packages.create(pkg_hash) do |p|
|
||||||
p.project = prj
|
p.project = prj
|
||||||
|
|
Loading…
Reference in New Issue