Merge pull request #38 from abf/rosa-build:unlock-rep-and-platform-when-validation-failed

AbfWorker::PublishObserver: Validation failed
This commit is contained in:
warpc 2013-03-22 15:55:48 +04:00
commit a4488727d3
3 changed files with 15 additions and 6 deletions

View File

@ -32,7 +32,7 @@ module AbfWorker
def sort_results_and_save(results, item = subject)
item.results = results.sort_by{ |r| r['file_name'] }
item.save!
item.save(false)
end
end

View File

@ -228,6 +228,17 @@ module AbfWorker
end
def create_rpm_build_task(save_to_repository_id, build_for_platform_id)
projects_for_cleanup = @redis.lrange(PROJECTS_FOR_CLEANUP, 0, -1).
select{ |k| k =~ /#{save_to_repository_id}\-#{build_for_platform_id}$/ }
# We should not to publish new builds into repository
# if project of builds has been removed from repository.
BuildList.where(
:project_id => projects_for_cleanup.map{ |k| k.split('-')[0] }.uniq,
:save_to_repository_id => repository.id,
:status => BuildList::BUILD_PUBLISH
).update_all(:status => BuildList::FAILED_PUBLISH)
build_lists = BuildList.
where(:new_core => true, :status => BuildList::BUILD_PUBLISH).
where(:save_to_repository_id => save_to_repository_id).
@ -237,9 +248,6 @@ module AbfWorker
build_lists = build_lists.where('build_lists.id NOT IN (?)', locked_ids) unless locked_ids.empty?
build_lists = build_lists.limit(50)
projects_for_cleanup = @redis.lrange(PROJECTS_FOR_CLEANUP, 0, -1).
select{ |k| k =~ /#{save_to_repository_id}\-#{build_for_platform_id}$/ }
old_packages = {:sources => [], :binaries => {:x86_64 => [], :i586 => []}}
projects_for_cleanup.each do |key|

View File

@ -36,9 +36,10 @@ module AbfWorker
update_results build_list
case status
when COMPLETED
build_list.published
# 'update_column' - when project of build_list has been removed from repository
build_list.published || build_list.update_column(:status, BuildList::BUILD_PUBLISHED)
when FAILED, CANCELED
build_list.fail_publish
build_list.fail_publish || build_list.update_column(:status, BuildList::FAILED_PUBLISH)
end
AbfWorker::BuildListsPublishTaskManager.unlock_build_list build_list
end