send task to abf-worker

This commit is contained in:
Vokhmin Alexey V 2012-11-26 22:00:29 +04:00
parent 22b7ba5bd5
commit c7ea2f7656
2 changed files with 50 additions and 1 deletions

View File

@ -243,8 +243,39 @@ class BuildList < ActiveRecord::Base
def add_to_queue
include_repos_hash = {}.tap do |h|
include_repos.each do |r|
repo = Repository.find r
h[repo.name] = repo.platform.public_downloads_url(nil, arch, repo.name)
end
end
options = {
:id => id,
:arch => arch.name,
:time_living => 2880, # 2 days
:distrib_type => build_for_platform.distrib_type,
:git_project_address => 'https://abf.rosalinux.ru/import/qtiplot.git',
# :git_project_address => project.git_project_address,
:commit_hash => '9272c173c517178b5c039c4b196c719b472147a7',
# :commit_hash => commit_hash,
:build_requires => build_requires,
:include_repos => include_repos_hash
# :project_version => project_version,
# :plname => save_to_platform.name,
# :bplname => (save_to_platform_id == build_for_platform_id ? '' : build_for_platform.name),
# :update_type => update_type,
# :priority => priority,
}
Resque.push(
'rpm_worker',
'class' => 'AbfWorker::RpmWorker',
'args' => [options]
)
@status ||= BUILD_PENDING
#XML-RPC params: project_name, project_version, plname, arch, bplname, update_type, build_requires, id_web, include_repos, priority, git_project_address
@status ||= BuildServer.add_build_list project.name, project_version, save_to_platform.name, arch.name, (save_to_platform_id == build_for_platform_id ? '' : build_for_platform.name), update_type, build_requires, id, include_repos, priority, project.git_project_address
# @status ||= BuildServer.add_build_list project.name, project_version, save_to_platform.name, arch.name, (save_to_platform_id == build_for_platform_id ? '' : build_for_platform.name), update_type, build_requires, id, include_repos, priority, project.git_project_address
end
def self.human_status(status)

View File

@ -0,0 +1,18 @@
module AbfWorker
class RpmWorkerObserver
@queue = :rpm_worker_observer
def self.perform(options)
bl = BuildList.find options['id']
case options['status'].to_i
when 0
bl.build_success
when 1
bl.build_error
when 3
bl.start_build
end
end
end
end