diff --git a/app/controllers/api/v1/jobs_controller.rb b/app/controllers/api/v1/jobs_controller.rb index 488590a74..be91c6155 100644 --- a/app/controllers/api/v1/jobs_controller.rb +++ b/app/controllers/api/v1/jobs_controller.rb @@ -8,8 +8,12 @@ class Api::V1::JobsController < Api::V1::BaseController before_filter :authenticate_user! def shift + platform_ids = Platform.where(name: params[:platforms].split(',')).pluck(:id) if params[:platforms].present? + arch_ids = Arch.where(name: params[:arches].split(',')).pluck(:id) if params[:arches].present? ActiveRecord::Base.transaction do - build_lists = BuildList.for_status(BuildList::BUILD_PENDING).oldest.order(:created_at) + build_lists = BuildList.for_status(BuildList::BUILD_PENDING).scoped_to_arch(arch_ids). + oldest.order(:created_at) + build_lists = build_lists.for_platform(platform_ids) if platform_ids.present? if current_user.system? # TODO: rollback later # @build_list = build_lists.not_owned_external_nodes.first @@ -42,6 +46,14 @@ class Api::V1::JobsController < Api::V1::BaseController render :text => Resque.redis.get(params[:key]) end + def logs + name = params[:name] + if name =~ /abfworker::rpm-worker/ + Resque.redis.setex name, 15, params[:logs] + end + render :nothing => true + end + def feedback worker_queue = params[:worker_queue] worker_class = params[:worker_class] diff --git a/config/routes.rb b/config/routes.rb index 286b8cef7..ec08bf7b7 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -105,6 +105,7 @@ Rosa::Application.routes.draw do get :shift get :status put :feedback + put :logs end end