diff --git a/app/admin/users.rb b/app/admin/users.rb index 42e138c69..6748e7f42 100644 --- a/app/admin/users.rb +++ b/app/admin/users.rb @@ -7,6 +7,8 @@ ActiveAdmin.register User do filter :role, as: :select, collection: User::EXTENDED_ROLES filter :created_at + permit_params :name, :email, :uname, :role, :password, :password_confirmation + controller do def update(options={}, &block) user_params = params[:user] diff --git a/app/controllers/api/v1/jobs_controller.rb b/app/controllers/api/v1/jobs_controller.rb index cd5dda057..f02bdc1f3 100644 --- a/app/controllers/api/v1/jobs_controller.rb +++ b/app/controllers/api/v1/jobs_controller.rb @@ -8,17 +8,17 @@ class Api::V1::JobsController < Api::V1::BaseController skip_after_action :verify_authorized def shift - @build_list = BuildList.next_build(arch_ids, platform_ids) if current_user.system? - if @build_list - set_builder - else - build_lists = BuildList.scoped_to_arch(arch_ids). - for_status([BuildList::BUILD_PENDING, BuildList::RERUN_TESTS]). - for_platform(platform_ids). - oldest.order(:created_at) + uid = BuildList.scoped_to_arch(arch_ids). + for_status([BuildList::BUILD_PENDING, BuildList::RERUN_TESTS]). + for_platform(platform_ids).pluck('DISTINCT user_id').sample + + if uid + build_lists = BuildList.for_status([BuildList::BUILD_PENDING, BuildList::RERUN_TESTS]). + where(user_id: uid).oldest.order(:created_at) ActiveRecord::Base.transaction do if current_user.system? + @build_list = build_lists.external_nodes("").first @build_list ||= build_lists.external_nodes(:everything).first else @build_list = build_lists.external_nodes(:owned).for_user(current_user).first diff --git a/app/models/build_list.rb b/app/models/build_list.rb index d62386e87..a3007b6c0 100644 --- a/app/models/build_list.rb +++ b/app/models/build_list.rb @@ -183,9 +183,9 @@ class BuildList < ActiveRecord::Base state_machine :status, initial: :waiting_for_response do - after_transition(on: [:place_build, :rerun_tests]) do |build_list, transition| - build_list.add_job_to_abf_worker_queue if build_list.external_nodes.blank? - end + #after_transition(on: [:place_build, :rerun_tests]) do |build_list, transition| + #build_list.add_job_to_abf_worker_queue if build_list.external_nodes.blank? + #end after_transition on: :published, do: %i(set_version_and_tag actualize_packages)