#298: auto publish packages only with > version
This commit is contained in:
parent
c03b4aaab6
commit
e7e5414db7
|
@ -280,6 +280,20 @@ class BuildList < ActiveRecord::Base
|
|||
build_started? || build_pending?
|
||||
end
|
||||
|
||||
def can_auto_publish?
|
||||
return false if !(auto_publish? && can_publish?)
|
||||
|
||||
if last_bl = last_published.last
|
||||
return true if last_bl.source_packages.count != source_packages.count
|
||||
last_bl.source_packages.each do |sp|
|
||||
return true if source_packages.find{ |nsp| nsp.name == sp.name && nsp.version > sp.version }
|
||||
end
|
||||
else
|
||||
return true # no published packages
|
||||
end
|
||||
return false # no new packages
|
||||
end
|
||||
|
||||
def can_publish?
|
||||
[SUCCESS, FAILED_PUBLISH, BUILD_PUBLISHED, TESTS_FAILED].include?(status) && extra_build_lists_published? && save_to_repository.projects.exists?(:id => project_id)
|
||||
end
|
||||
|
|
|
@ -17,7 +17,7 @@ module AbfWorker
|
|||
case status
|
||||
when COMPLETED
|
||||
subject.build_success
|
||||
subject.now_publish if subject.auto_publish? && subject.can_publish?
|
||||
subject.now_publish if subject.can_auto_publish?
|
||||
when FAILED
|
||||
subject.build_error
|
||||
item.update_attributes({:status => BuildList::BUILD_ERROR})
|
||||
|
|
Loading…
Reference in New Issue