more methods fot build lists, added is_circle build flag
This commit is contained in:
parent
866041a3e2
commit
62d0985fcb
|
@ -6,6 +6,8 @@ class BuildListsController < ApplicationController
|
||||||
before_filter :find_arches, :only => [:index, :filter]
|
before_filter :find_arches, :only => [:index, :filter]
|
||||||
before_filter :find_branches, :only => [:index, :filter]
|
before_filter :find_branches, :only => [:index, :filter]
|
||||||
|
|
||||||
|
before_filter :find_build_list_by_bs, :only => [:status_build, :pre_build]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@build_lists = @project.build_lists.recent.paginate :page => params[:page]
|
@build_lists = @project.build_lists.recent.paginate :page => params[:page]
|
||||||
@filter = BuildList::Filter.new(@project)
|
@filter = BuildList::Filter.new(@project)
|
||||||
|
@ -19,8 +21,27 @@ class BuildListsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def status_build
|
def status_build
|
||||||
@build_list = BuildList.find_by_bs_id!(params[:id])
|
#
|
||||||
|
# @build_list.status = params[:status]
|
||||||
|
# @build_list.container_path = params[:container_path]
|
||||||
|
# @build_list.notified_at = Time.now
|
||||||
|
#
|
||||||
|
# @build_list.save
|
||||||
|
|
||||||
|
render :nothing => true, :status => 200
|
||||||
|
end
|
||||||
|
|
||||||
|
def pre_build
|
||||||
|
@build_list.status = BuildList::BUILD_STARTED
|
||||||
|
@build_list.container_path = params[:container_path]
|
||||||
|
@build_list.notified_at = Time.now
|
||||||
|
|
||||||
|
@build_list.save
|
||||||
|
|
||||||
|
render :nothing => true, :status => 200
|
||||||
|
end
|
||||||
|
|
||||||
|
def post_build
|
||||||
@build_list.status = params[:status]
|
@build_list.status = params[:status]
|
||||||
@build_list.container_path = params[:container_path]
|
@build_list.container_path = params[:container_path]
|
||||||
@build_list.notified_at = Time.now
|
@build_list.notified_at = Time.now
|
||||||
|
@ -30,6 +51,16 @@ class BuildListsController < ApplicationController
|
||||||
render :nothing => true, :status => 200
|
render :nothing => true, :status => 200
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def circle_build
|
||||||
|
@build_list.is_circle = true
|
||||||
|
@build_list.container_path = params[:container_path]
|
||||||
|
@build_list.notified_at = Time.now
|
||||||
|
|
||||||
|
@build_list.save
|
||||||
|
|
||||||
|
render :nothing => true, :status => 200
|
||||||
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
def find_platform
|
def find_platform
|
||||||
@platform = Platform.find params[:platform_id]
|
@platform = Platform.find params[:platform_id]
|
||||||
|
@ -52,4 +83,8 @@ class BuildListsController < ApplicationController
|
||||||
@branches = @git_repository.branches
|
@branches = @git_repository.branches
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def find_build_list_by_bs
|
||||||
|
@build_list = BuildList.find_by_bs_id!(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
|
@ -5,21 +5,26 @@ class BuildList < ActiveRecord::Base
|
||||||
validates :project_id, :presence => true
|
validates :project_id, :presence => true
|
||||||
validates :branch_name, :presence => true
|
validates :branch_name, :presence => true
|
||||||
|
|
||||||
STATUSES = [BuildServer::SUCCESS, BuildServer::BUILD_PENDING, BuildServer::BUILD_ERROR, BuildServer::DEPENDENCIES_FAIL, BuildServer::SRPM_NOT_FOUND, BuildServer::MOCK_NOT_FOUND]
|
BUILD_PENDING = 2
|
||||||
BUILD_ERROR_STATUSES = [ BuildServer::BUILD_ERROR, BuildServer::MOCK_NOT_FOUND, BuildServer::DEPENDENCIES_FAIL, BuildServer::SRPM_NOT_FOUND]
|
BUILD_STARTED = 3
|
||||||
|
|
||||||
|
STATUSES = [BuildServer::SUCCESS, BUILD_PENDING, BUILD_STARTED, BuildServer::BUILD_ERROR] #, BuildServer::DEPENDENCIES_FAIL, BuildServer::SRPM_NOT_FOUND, BuildServer::MOCK_NOT_FOUND]
|
||||||
|
# BUILD_ERROR_STATUSES = [ BuildServer::BUILD_ERROR, BuildServer::MOCK_NOT_FOUND, BuildServer::DEPENDENCIES_FAIL, BuildServer::SRPM_NOT_FOUND]
|
||||||
HUMAN_STATUSES = { BuildServer::BUILD_ERROR => :build_error,
|
HUMAN_STATUSES = { BuildServer::BUILD_ERROR => :build_error,
|
||||||
BuildServer::MOCK_NOT_FOUND => :mock_not_found,
|
# BuildServer::MOCK_NOT_FOUND => :mock_not_found,
|
||||||
BuildServer::DEPENDENCIES_FAIL => :dependencies_fail,
|
# BuildServer::DEPENDENCIES_FAIL => :dependencies_fail,
|
||||||
BuildServer::SRPM_NOT_FOUND => :srpm_not_found,
|
# BuildServer::SRPM_NOT_FOUND => :srpm_not_found,
|
||||||
BuildServer::BUILD_PENDING => :build_pending,
|
BUILD_PENDING => :build_pending,
|
||||||
|
BUILD_STARTED => :build_started,
|
||||||
BuildServer::SUCCESS => :success
|
BuildServer::SUCCESS => :success
|
||||||
}
|
}
|
||||||
|
|
||||||
scope :recent, order("created_at DESC")
|
scope :recent, order("created_at DESC")
|
||||||
scope :current, lambda { where(["status in (?) OR (status = ? AND notified_at >= ?)", BUILD_ERROR_STATUSES + [BuildServer::BUILD_PENDING], BuildServer::SUCCESS, Time.now - 2.days]) }
|
scope :current, lambda { where(["status in (?) OR (status in (?) AND notified_at >= ?)", [BUILD_PENDING, BUILD_STARTED], [BuildServer::SUCCESS, BuildServer::ERROR], Time.now - 2.days]) }
|
||||||
scope :for_status, lambda {|status| where(:status => status) }
|
scope :for_status, lambda {|status| where(:status => status) }
|
||||||
scope :scoped_to_arch, lambda {|arch| where(:arch_id => arch) }
|
scope :scoped_to_arch, lambda {|arch| where(:arch_id => arch) }
|
||||||
scope :scoped_to_branch, lambda {|branch| where(:branch_name => branch) }
|
scope :scoped_to_branch, lambda {|branch| where(:branch_name => branch) }
|
||||||
|
scope :scoped_to_is_circle, lambda {|is_circle| where(:is_circle => is_circle) }
|
||||||
scope :for_creation_date_period, lambda{|start_date, end_date|
|
scope :for_creation_date_period, lambda{|start_date, end_date|
|
||||||
if start_date && end_date
|
if start_date && end_date
|
||||||
where(["created_at BETWEEN ? AND ?", start_date, end_date])
|
where(["created_at BETWEEN ? AND ?", start_date, end_date])
|
||||||
|
|
|
@ -12,6 +12,7 @@ class BuildList::Filter
|
||||||
build_lists = build_lists.for_status(@options[:status]) if @options[:status]
|
build_lists = build_lists.for_status(@options[:status]) if @options[:status]
|
||||||
build_lists = build_lists.scoped_to_arch(@options[:arch_id]) if @options[:arch_id]
|
build_lists = build_lists.scoped_to_arch(@options[:arch_id]) if @options[:arch_id]
|
||||||
build_lists = build_lists.scoped_to_branch(@options[:branch_name]) if @options[:branch_name]
|
build_lists = build_lists.scoped_to_branch(@options[:branch_name]) if @options[:branch_name]
|
||||||
|
build_lists = build_lists.scoped_to_is_circle(@options[:is_circle]) if @options[:is_circle].present?
|
||||||
|
|
||||||
if @options[:created_at_start] || @options[:created_at_end]
|
if @options[:created_at_start] || @options[:created_at_end]
|
||||||
build_lists = build_lists.for_creation_date_period(@options[:created_at_start], @options[:created_at_end])
|
build_lists = build_lists.for_creation_date_period(@options[:created_at_start], @options[:created_at_end])
|
||||||
|
@ -42,6 +43,7 @@ class BuildList::Filter
|
||||||
:notified_at_start => nil,
|
:notified_at_start => nil,
|
||||||
:notified_at_end => nil,
|
:notified_at_end => nil,
|
||||||
:arch_id => nil,
|
:arch_id => nil,
|
||||||
|
:is_circle => nil,
|
||||||
:branch_name => nil
|
:branch_name => nil
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
@ -52,6 +54,7 @@ class BuildList::Filter
|
||||||
@options[:notified_at_end] = build_date_from_params(:notified_at_end, @options)
|
@options[:notified_at_end] = build_date_from_params(:notified_at_end, @options)
|
||||||
@options[:branch_name] = @options[:branch_name].present? ? @options[:branch_name] : nil
|
@options[:branch_name] = @options[:branch_name].present? ? @options[:branch_name] : nil
|
||||||
@options[:arch_id] = @options[:arch_id].present? ? @options[:arch_id].to_i : nil
|
@options[:arch_id] = @options[:arch_id].present? ? @options[:arch_id].to_i : nil
|
||||||
|
@options[:is_circle] = @options[:is_circle].present? ? @options[:is_circle] == "1" : nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def build_date_from_params(field_name, params)
|
def build_date_from_params(field_name, params)
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
%th= t("activerecord.attributes.build_list.branch_name")
|
%th= t("activerecord.attributes.build_list.branch_name")
|
||||||
%th= t("activerecord.attributes.build_list.project")
|
%th= t("activerecord.attributes.build_list.project")
|
||||||
%th= t("activerecord.attributes.build_list.arch")
|
%th= t("activerecord.attributes.build_list.arch")
|
||||||
|
%th= t("activerecord.attributes.build_list.is_circle")
|
||||||
%th.last= t("activerecord.attributes.build_list.notified_at")
|
%th.last= t("activerecord.attributes.build_list.notified_at")
|
||||||
|
|
||||||
- build_lists.each do |build_list|
|
- build_lists.each do |build_list|
|
||||||
|
@ -14,6 +15,7 @@
|
||||||
%td= link_to build_list.branch_name, "#"
|
%td= link_to build_list.branch_name, "#"
|
||||||
%td= link_to build_list.project.name, platform_repository_project_path(@platform, @repository, @project)
|
%td= link_to build_list.project.name, platform_repository_project_path(@platform, @repository, @project)
|
||||||
%td= build_list.arch.name
|
%td= build_list.arch.name
|
||||||
|
%td= build_list.is_circle?
|
||||||
%td.last= build_list.notified_at
|
%td.last= build_list.notified_at
|
||||||
|
|
||||||
= will_paginate build_lists
|
= will_paginate build_lists
|
|
@ -18,6 +18,11 @@
|
||||||
= f.label :branch_name, "Branch", :class => :label
|
= f.label :branch_name, "Branch", :class => :label
|
||||||
= f.select :branch_name, @branches.collect{|branch| [branch.name, branch.name]}, :include_blank => true, :selected => @filter.branch_name
|
= f.select :branch_name, @branches.collect{|branch| [branch.name, branch.name]}, :include_blank => true, :selected => @filter.branch_name
|
||||||
|
|
||||||
|
.group
|
||||||
|
= f.label :is_circle, t("activerecord.attributes.build_list.is_circle"), :class => :label
|
||||||
|
= f.select :is_circle, [[t("layout.yes_"), 1], [t("layout.no_"), 0]], :include_blank => true, :selected => @filter.is_circle.present? ? (@filter.is_circle ? "1" : "0") : nil
|
||||||
|
|
||||||
|
|
||||||
.columns.wat-cf
|
.columns.wat-cf
|
||||||
.column.left
|
.column.left
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,8 @@ ru:
|
||||||
are_you_sure: "Вы уверены?"
|
are_you_sure: "Вы уверены?"
|
||||||
login: Войти
|
login: Войти
|
||||||
or: или
|
or: или
|
||||||
|
yes_: Да
|
||||||
|
no_: Нет
|
||||||
menu:
|
menu:
|
||||||
users: Пользователи
|
users: Пользователи
|
||||||
platforms: Платформы
|
platforms: Платформы
|
||||||
|
@ -93,8 +95,9 @@ ru:
|
||||||
mock_not_found: mock не найден
|
mock_not_found: mock не найден
|
||||||
dependencies_fail: dependencies fail
|
dependencies_fail: dependencies fail
|
||||||
srpm_not_found: srpm не найден
|
srpm_not_found: srpm не найден
|
||||||
build_pending: собирается
|
build_pending: ожидает сборку
|
||||||
success: собран
|
success: собран
|
||||||
|
build_started: собирается
|
||||||
|
|
||||||
flash:
|
flash:
|
||||||
project:
|
project:
|
||||||
|
@ -202,6 +205,7 @@ ru:
|
||||||
project: Проект
|
project: Проект
|
||||||
arch_id: Архитектура
|
arch_id: Архитектура
|
||||||
arch: Архитектура
|
arch: Архитектура
|
||||||
|
is_circle: Циклическая сборка
|
||||||
notified_at: Информация получена
|
notified_at: Информация получена
|
||||||
updated_at: Обновлен
|
updated_at: Обновлен
|
||||||
created_at: Создан
|
created_at: Создан
|
||||||
|
|
|
@ -23,7 +23,8 @@ Rosa::Application.routes.draw do
|
||||||
resources :users
|
resources :users
|
||||||
|
|
||||||
match 'build_lists/status_build', :to => "build_lists#status_build"
|
match 'build_lists/status_build', :to => "build_lists#status_build"
|
||||||
|
match 'build_lists/post_build', :to => "build_lists#post_build"
|
||||||
|
match 'build_lists/circle_build', :to => "build_lists#circle_build"
|
||||||
|
|
||||||
# Tree
|
# Tree
|
||||||
match 'platforms/:platform_id/repositories/:repository_id/projects/:project_id/git/tree/:treeish(/*path)', :controller => "git/trees", :action => :show, :treeish => /[0-9a-zA-Z_.\-]*/, :defaults => { :treeish => :master }, :as => :tree
|
match 'platforms/:platform_id/repositories/:repository_id/projects/:project_id/git/tree/:treeish(/*path)', :controller => "git/trees", :action => :show, :treeish => /[0-9a-zA-Z_.\-]*/, :defaults => { :treeish => :master }, :as => :tree
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
class AddIsCircleToBuildLists < ActiveRecord::Migration
|
||||||
|
def self.up
|
||||||
|
add_column :build_lists, :is_circle, :boolean, :default => false
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.down
|
||||||
|
remove_column :build_lists, :is_circle
|
||||||
|
end
|
||||||
|
end
|
|
@ -10,7 +10,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended to check this file into your version control system.
|
# It's strongly recommended to check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(:version => 20110405161609) do
|
ActiveRecord::Schema.define(:version => 20110407144147) do
|
||||||
|
|
||||||
create_table "arches", :force => true do |t|
|
create_table "arches", :force => true do |t|
|
||||||
t.string "name", :null => false
|
t.string "name", :null => false
|
||||||
|
@ -30,6 +30,7 @@ ActiveRecord::Schema.define(:version => 20110405161609) do
|
||||||
t.datetime "notified_at"
|
t.datetime "notified_at"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
|
t.boolean "is_circle", :default => false
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "build_lists", ["arch_id"], :name => "index_build_lists_on_arch_id"
|
add_index "build_lists", ["arch_id"], :name => "index_build_lists_on_arch_id"
|
||||||
|
|
|
@ -9,7 +9,6 @@ class BuildServer
|
||||||
PROJECT_NOT_FOUND = 3
|
PROJECT_NOT_FOUND = 3
|
||||||
BRANCH_NOT_FOUND = 4
|
BRANCH_NOT_FOUND = 4
|
||||||
|
|
||||||
BUILD_PENDING = 1
|
|
||||||
BUILD_ERROR = 2500
|
BUILD_ERROR = 2500
|
||||||
MOCK_NOT_FOUND = 256
|
MOCK_NOT_FOUND = 256
|
||||||
DEPENDENCIES_FAIL = 7680
|
DEPENDENCIES_FAIL = 7680
|
||||||
|
|
Loading…
Reference in New Issue