From c7ea2f7656facf49448c5a3169692f2c491c5186 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Mon, 26 Nov 2012 22:00:29 +0400 Subject: [PATCH] send task to abf-worker --- app/models/build_list.rb | 33 ++++++++++++++++++++++++++- lib/abf_worker/rpm_worker_observer.rb | 18 +++++++++++++++ 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 lib/abf_worker/rpm_worker_observer.rb diff --git a/app/models/build_list.rb b/app/models/build_list.rb index b02d231b7..c1d421767 100644 --- a/app/models/build_list.rb +++ b/app/models/build_list.rb @@ -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) diff --git a/lib/abf_worker/rpm_worker_observer.rb b/lib/abf_worker/rpm_worker_observer.rb new file mode 100644 index 000000000..1549b267d --- /dev/null +++ b/lib/abf_worker/rpm_worker_observer.rb @@ -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 \ No newline at end of file