[refs #442] Add mass build counters ant their update. Add failed builds report generate
This commit is contained in:
parent
edcc0c996f
commit
f3bd3bbd7f
|
@ -31,6 +31,11 @@ class Platforms::PlatformsController < Platforms::BaseController
|
|||
render :action => :build_all
|
||||
end
|
||||
|
||||
def get_failed_builds_list
|
||||
@mass_build = MassBuild.find params[:mass_build_id]
|
||||
send_file @mass_build.generate_failed_builds_list, :filename => "mass_build_#{@mass_build.id}"
|
||||
end
|
||||
|
||||
def index
|
||||
@platforms = @platforms.accessible_by(current_ability, :related).paginate(:page => params[:page], :per_page => 20)
|
||||
end
|
||||
|
|
|
@ -6,7 +6,7 @@ class BuildList < ActiveRecord::Base
|
|||
belongs_to :build_for_platform, :class_name => 'Platform'
|
||||
belongs_to :user
|
||||
belongs_to :advisory
|
||||
belongs_to :mass_build
|
||||
belongs_to :mass_build, :counter_cache => true
|
||||
has_many :items, :class_name => "BuildList::Item", :dependent => :destroy
|
||||
has_many :packages, :class_name => "BuildList::Package", :dependent => :destroy
|
||||
|
||||
|
@ -103,6 +103,14 @@ class BuildList < ActiveRecord::Base
|
|||
|
||||
state_machine :status, :initial => :waiting_for_response do
|
||||
|
||||
around_transition do |build_list, transition, block|
|
||||
if build_list.mass_build
|
||||
MassBuild.decrement_counter "#{BuildList::HUMAN_STATUSES[build_list.status].to_s}_count", build_list.mass_build_id
|
||||
block.call
|
||||
MassBuild.increment_counter "#{BuildList::HUMAN_STATUSES[build_list.status].to_s}_count", build_list.mass_build_id
|
||||
end
|
||||
end
|
||||
|
||||
after_transition :on => :published, :do => :set_version_and_tag
|
||||
|
||||
event :place_build do
|
||||
|
|
|
@ -32,4 +32,13 @@ class MassBuild < ActiveRecord::Base
|
|||
:auto_publish => self.auto_publish
|
||||
) # later with resque
|
||||
end
|
||||
|
||||
def generate_failed_builds_list
|
||||
report = ""
|
||||
BuildList.where(:status => BuildServer::BUILD_ERROR, :mass_build_id => self.id).each do |build_list|
|
||||
report << "ID: #{build_list.id}; "
|
||||
report << "PROJECT_NAME: #{build_list.project.name}\n"
|
||||
end
|
||||
report
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
class AddCountersToMassBuilds < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :mass_builds, :build_lists_count, :integer, :default => 0
|
||||
add_column :mass_builds, :build_published_count, :integer, :default => 0
|
||||
add_column :mass_builds, :build_pending_count, :integer, :default => 0
|
||||
add_column :mass_builds, :build_started_count, :integer, :default => 0
|
||||
add_column :mass_builds, :build_publish_count, :integer, :default => 0
|
||||
end
|
||||
end
|
36
db/schema.rb
36
db/schema.rb
|
@ -11,14 +11,14 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20120609163454) do
|
||||
ActiveRecord::Schema.define(:version => 20120622092725) do
|
||||
|
||||
create_table "activity_feeds", :force => true do |t|
|
||||
t.integer "user_id", :null => false
|
||||
t.string "kind"
|
||||
t.text "data"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
create_table "advisories", :force => true do |t|
|
||||
|
@ -199,11 +199,16 @@ ActiveRecord::Schema.define(:version => 20120609163454) do
|
|||
create_table "mass_builds", :force => true do |t|
|
||||
t.integer "platform_id"
|
||||
t.string "name"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.string "arch_names"
|
||||
t.integer "user_id"
|
||||
t.boolean "auto_publish", :default => false, :null => false
|
||||
t.boolean "auto_publish", :default => false, :null => false
|
||||
t.integer "build_lists_count", :default => 0
|
||||
t.integer "build_published_count", :default => 0
|
||||
t.integer "build_pending_count", :default => 0
|
||||
t.integer "build_started_count", :default => 0
|
||||
t.integer "build_publish_count", :default => 0
|
||||
end
|
||||
|
||||
create_table "platforms", :force => true do |t|
|
||||
|
@ -217,7 +222,7 @@ ActiveRecord::Schema.define(:version => 20120609163454) do
|
|||
t.string "owner_type"
|
||||
t.string "visibility", :default => "open", :null => false
|
||||
t.string "platform_type", :default => "main", :null => false
|
||||
t.string "distrib_type", :null => false
|
||||
t.string "distrib_type"
|
||||
end
|
||||
|
||||
add_index "platforms", ["name"], :name => "index_platforms_on_name", :unique => true, :case_sensitive => false
|
||||
|
@ -288,27 +293,25 @@ ActiveRecord::Schema.define(:version => 20120609163454) do
|
|||
t.text "description"
|
||||
t.string "ancestry"
|
||||
t.boolean "has_issues", :default => true
|
||||
t.boolean "has_wiki", :default => false
|
||||
t.string "srpm_file_name"
|
||||
t.string "srpm_content_type"
|
||||
t.integer "srpm_file_size"
|
||||
t.datetime "srpm_updated_at"
|
||||
t.boolean "has_wiki", :default => false
|
||||
t.string "default_branch", :default => "master"
|
||||
t.boolean "is_package", :default => true, :null => false
|
||||
t.integer "average_build_time", :default => 0, :null => false
|
||||
t.integer "build_count", :default => 0, :null => false
|
||||
end
|
||||
|
||||
add_index "projects", ["owner_id"], :name => "index_projects_on_name_and_owner_id_and_owner_type", :unique => true, :case_sensitive => false
|
||||
|
||||
create_table "register_requests", :force => true do |t|
|
||||
t.string "name"
|
||||
t.string "email"
|
||||
t.string "token"
|
||||
t.boolean "approved", :default => false
|
||||
t.boolean "rejected", :default => false
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.string "interest"
|
||||
t.text "more"
|
||||
end
|
||||
|
@ -362,6 +365,7 @@ ActiveRecord::Schema.define(:version => 20120609163454) do
|
|||
t.string "name"
|
||||
t.string "email", :default => "", :null => false
|
||||
t.string "encrypted_password", :limit => 128, :default => "", :null => false
|
||||
t.string "password_salt", :default => "", :null => false
|
||||
t.string "reset_password_token"
|
||||
t.datetime "remember_created_at"
|
||||
t.datetime "created_at"
|
||||
|
@ -369,8 +373,11 @@ ActiveRecord::Schema.define(:version => 20120609163454) do
|
|||
t.string "uname"
|
||||
t.string "role"
|
||||
t.string "language", :default => "en"
|
||||
t.datetime "reset_password_sent_at"
|
||||
t.string "confirmation_token"
|
||||
t.datetime "confirmed_at"
|
||||
t.datetime "confirmation_sent_at"
|
||||
t.integer "own_projects_count", :default => 0, :null => false
|
||||
t.datetime "reset_password_sent_at"
|
||||
t.text "professional_experience"
|
||||
t.string "site"
|
||||
t.string "company"
|
||||
|
@ -382,9 +389,6 @@ ActiveRecord::Schema.define(:version => 20120609163454) do
|
|||
t.integer "failed_attempts", :default => 0
|
||||
t.string "unlock_token"
|
||||
t.datetime "locked_at"
|
||||
t.string "confirmation_token"
|
||||
t.datetime "confirmed_at"
|
||||
t.datetime "confirmation_sent_at"
|
||||
t.string "authentication_token"
|
||||
t.integer "build_priority", :default => 50
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue