Confilict resolve

This commit is contained in:
Alexey Nayden 2011-04-11 20:57:43 +04:00
commit 231771890e
23 changed files with 479 additions and 36 deletions

View File

@ -50,5 +50,6 @@ gem "hoptoad_notifier", "~> 2.3"
gem "russian" gem "russian"
gem "grit" gem "grit"
gem 'unicorn' gem 'unicorn'
gem 'delayed_job'
gem 'jammit' gem 'jammit'

View File

@ -42,6 +42,10 @@ GEM
closure-compiler (1.1.1) closure-compiler (1.1.1)
compass (0.10.6) compass (0.10.6)
haml (>= 3.0.4) haml (>= 3.0.4)
daemons (1.1.0)
delayed_job (2.1.4)
activesupport (~> 3.0)
daemons
devise (1.1.7) devise (1.1.7)
bcrypt-ruby (~> 2.1.2) bcrypt-ruby (~> 2.1.2)
warden (~> 1.0.2) warden (~> 1.0.2)
@ -142,6 +146,7 @@ DEPENDENCIES
capistrano capistrano
capistrano-ext capistrano-ext
compass (>= 0.10.6) compass (>= 0.10.6)
delayed_job
devise devise
factory_girl_rails factory_girl_rails
grit grit

View File

@ -10,4 +10,16 @@ class ApplicationController < ActionController::Base
"application" "application"
end end
end end
def authenticate_build_service!
if request.remote_ip != APP_CONFIG['build_service_ip']
render :nothing => true, :status => 403
end
end
def authenticate_product_builder!
if request.remote_ip != APP_CONFIG['product_builder_ip']
render :nothing => true, :status => 403
end
end
end end

View File

@ -1,12 +1,13 @@
class BuildListsController < ApplicationController class BuildListsController < ApplicationController
before_filter :authenticate_user!, :except => [:status_build, :pre_build, :post_build] before_filter :authenticate_user!, :except => [:status_build, :pre_build, :post_build, :circle_build, :new_bbdt]
before_filter :find_platform, :only => [:index, :filter] before_filter :authenticate_build_service!, :only => [:status_build, :pre_build, :post_build, :circle_build, :new_bbdt]
before_filter :find_repository, :only => [:index, :filter] before_filter :find_platform, :only => [:index, :filter, :show]
before_filter :find_project, :only => [:index, :filter] before_filter :find_repository, :only => [:index, :filter, :show]
before_filter :find_project, :only => [:index, :filter, :show]
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] before_filter :find_build_list_by_bs, :only => [:status_build, :pre_build, :new_bbdt]
def index def index
@build_lists = @project.build_lists.recent.paginate :page => params[:page] @build_lists = @project.build_lists.recent.paginate :page => params[:page]
@ -20,13 +21,20 @@ class BuildListsController < ApplicationController
render :action => "index" render :action => "index"
end end
def show
@build_list = @project.build_lists.find(params[:id])
@item_groups = @build_list.items.group_by_level
end
def status_build def status_build
# @item = @build_list.items.find_by_name!(params[:package_name])
# @build_list.status = params[:status] @item.status = params[:status]
# @build_list.container_path = params[:container_path] @item.save
# @build_list.notified_at = Time.now
# @build_list.container_path = params[:container_path]
# @build_list.save @build_list.notified_at = Time.now
@build_list.save
render :nothing => true, :status => 200 render :nothing => true, :status => 200
end end
@ -61,6 +69,15 @@ class BuildListsController < ApplicationController
render :nothing => true, :status => 200 render :nothing => true, :status => 200
end end
def new_bbdt
@build_list.name = params[:name]
@build_list.additional_repos = params[:additional_repos]
@build_list.set_items(params[:items])
@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]
@ -87,4 +104,4 @@ class BuildListsController < ApplicationController
@build_list = BuildList.find_by_bs_id!(params[:id]) @build_list = BuildList.find_by_bs_id!(params[:id])
end end
end end

View File

@ -2,7 +2,7 @@ class ProjectsController < ApplicationController
before_filter :authenticate_user! before_filter :authenticate_user!
before_filter :find_platform before_filter :find_platform
before_filter :find_repository before_filter :find_repository
before_filter :find_project, :only => [:show, :destroy] before_filter :find_project, :only => [:show, :destroy, :build, :process_build]
def new def new
@project = @repository.projects.new @project = @repository.projects.new
@ -12,6 +12,37 @@ class ProjectsController < ApplicationController
@current_build_lists = @project.build_lists.current.recent.paginate :page => params[:page] @current_build_lists = @project.build_lists.current.recent.paginate :page => params[:page]
end end
def build
@branches = @project.git_repository.branches
@arches = Arch.recent
end
def process_build
@arch_ids = params[:build][:arches].select{|_,v| v == "1"}.collect{|x| x[0].to_i }
@arches = Arch.where(:id => @arch_ids)
@branches = @project.git_repository.branches
@branch = @branches.select{|branch| branch.name == params[:build][:branch] }.first
if !check_arches || !check_branches
@arches = Arch.recent
render :action => "build"
else
flash[:notice], flash[:error] = "", ""
@arches.each do |arch|
build_list = @project.build_lists.new(:arch => arch, :branch_name => @branch.name)
if build_list.save
flash[:notice] += t("flash.build_list.saved", :branch_name => @branch.name, :arch => arch.name)
else
flash[:error] += t("flash.build_list.save_error", :branch_name => @branch.name, :arch => arch.name)
end
end
redirect_to platform_repository_project_path(@platform, @repository, @project)
end
end
def create def create
@project = @repository.projects.new params[:project] @project = @repository.projects.new params[:project]
if @project.save if @project.save
@ -43,4 +74,28 @@ class ProjectsController < ApplicationController
def find_project def find_project
@project = @repository.projects.find params[:id] @project = @repository.projects.find params[:id]
end end
def check_arches
if @arch_ids.blank?
flash[:error] = t("flash.build_list.no_arch_selected")
false
elsif @arch_ids.length != @arches.length
flash[:error] = t("flash.build_list.no_arch_found")
false
else
true
end
end
def check_branches
if @branch.blank?
flash[:error] = t("flash.build_list.no_branch_selected")
false
elsif !@branches.include?(@branch)
flash[:error] = t("flash.build_list.no_branch_found")
false
else
true
end
end
end end

View File

@ -1,26 +1,41 @@
class BuildList < ActiveRecord::Base class BuildList < ActiveRecord::Base
belongs_to :project belongs_to :project
belongs_to :arch belongs_to :arch
has_many :items, :class_name => "BuildList::Item", :dependent => :destroy
validates :project_id, :presence => true validates :project_id, :presence => true
validates :branch_name, :presence => true validates :branch_name, :presence => true
BUILD_PENDING = 2 WAITING_FOR_RESPONSE = 4000
BUILD_STARTED = 3 BUILD_PENDING = 2000
BUILD_STARTED = 3000
STATUSES = [WAITING_FOR_RESPONSE,
BuildServer::SUCCESS,
BUILD_PENDING,
BUILD_STARTED,
BuildServer::BUILD_ERROR,
BuildServer::PLATFORM_NOT_FOUND,
BuildServer::PLATFORM_PENDING,
BuildServer::PROJECT_NOT_FOUND,
BuildServer::BRANCH_NOT_FOUND]
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::DEPENDENCIES_FAIL => :dependencies_fail,
# BuildServer::SRPM_NOT_FOUND => :srpm_not_found,
BUILD_PENDING => :build_pending, BUILD_PENDING => :build_pending,
BUILD_STARTED => :build_started, BUILD_STARTED => :build_started,
BuildServer::SUCCESS => :success BuildServer::SUCCESS => :success,
WAITING_FOR_RESPONSE => :waiting_for_response,
BuildServer::PLATFORM_NOT_FOUND => :platform_not_found,
BuildServer::PLATFORM_PENDING => :platform_pending,
BuildServer::PROJECT_NOT_FOUND => :project_not_found,
BuildServer::BRANCH_NOT_FOUND => :branch_not_found
} }
scope :recent, order("created_at DESC") scope :recent, order("created_at DESC")
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 :current, lambda {
outdatable_statuses = [BuildServer::SUCCESS, BuildServer::ERROR, BuildServer::PLATFORM_NOT_FOUND, BuildServer::PLATFORM_PENDING, BuildServer::PROJECT_NOT_FOUND, BuildServer::BRANCH_NOT_FOUND]
where(["status in (?) OR (status in (?) AND notified_at >= ?)", [WAITING_FOR_RESPONSE, BUILD_PENDING, BUILD_STARTED], outdatable_statuses, 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) }
@ -44,6 +59,11 @@ class BuildList < ActiveRecord::Base
end end
} }
serialize :additional_repos
before_create :set_default_status
after_create :place_build
def self.human_status(status) def self.human_status(status)
I18n.t("layout.build_lists.statuses.#{HUMAN_STATUSES[status]}") I18n.t("layout.build_lists.statuses.#{HUMAN_STATUSES[status]}")
end end
@ -52,4 +72,26 @@ class BuildList < ActiveRecord::Base
self.class.human_status(status) self.class.human_status(status)
end end
def set_items(items_hash)
self.items = []
items_hash.each do |level, items|
items.each do |item|
self.items << self.items.build(:name => item, :level => level.to_i)
end
end
end
private
def set_default_status
self.status = WAITING_FOR_RESPONSE unless self.status.present?
end
def place_build
self.status = BuildServer.add_build_list project.name, branch_name, project.platform.name, arch.name
self.status = BUILD_PENDING if self.status == 0
save
end
handle_asynchronously :place_build
end end

View File

@ -0,0 +1,38 @@
class BuildList::Item < ActiveRecord::Base
belongs_to :build_list
attr_protected :build_list_id
STATUSES = [BuildServer::SUCCESS, BuildServer::DEPENDENCIES_FAIL, BuildServer::SRPM_NOT_FOUND, BuildServer::MOCK_NOT_FOUND]
HUMAN_STATUSES = {
BuildServer::MOCK_NOT_FOUND => :mock_not_found,
BuildServer::DEPENDENCIES_FAIL => :dependencies_fail,
BuildServer::SRPM_NOT_FOUND => :srpm_not_found,
BuildServer::SUCCESS => :success
}
scope :recent, order("level ASC, name ASC")
def self.group_by_level
items = scoped({}).recent
groups = []
current_level = -1
items.each do |item|
groups << [] if current_level < item.level
groups.last << item
current_level = item.level
end
groups
end
def self.human_status(status)
I18n.t("layout.build_lists.items.statuses.#{HUMAN_STATUSES[status]}")
end
def human_status
self.class.human_status(status)
end
end

View File

@ -10,12 +10,12 @@
- build_lists.each do |build_list| - build_lists.each do |build_list|
%tr{:class => cycle("odd", "even")} %tr{:class => cycle("odd", "even")}
%td= build_list.bs_id %td= link_to (build_list.bs_id.present? ? build_list.bs_id : t("layout.build_lists.bs_id_not_set")), platform_repository_project_build_list_path(@platform, @repository, @project, build_list)
%td= build_list.human_status %td= build_list.human_status
%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= t("layout.#{build_list.is_circle?}_")
%td.last= build_list.notified_at %td.last= build_list.notified_at
= will_paginate build_lists = will_paginate build_lists

View File

@ -0,0 +1,14 @@
.block.notice
%h3= t("layout.platforms.current_platform_header")
.content
%p= link_to @platform.name, platform_path(@platform)
.block.notice
%h3= t("layout.repositories.current_repository_header")
.content
%p= link_to @repository.name + repository_name_postfix(@platform), platform_repository_path(@platform, @repository)
.block.notice
%h3= t("layout.projects.current_project_header")
.content
%p= link_to @project.name, platform_repository_path(@platform, @repository) + "#projects"

View File

@ -12,4 +12,4 @@
.inner .inner
= render :partial => "build_lists/build_lists", :object => @build_lists = render :partial => "build_lists/build_lists", :object => @build_lists
- content_for :sidebar, render(:partial => 'git/shared/sidebar') - content_for :sidebar, render(:partial => 'sidebar')

View File

@ -0,0 +1,82 @@
.block
.secondary-navigation
%ul.wat-cf
%li.first= link_to t("layout.build_lists.current"), platform_repository_project_path(@platform, @repository, @project) + "#build_lists"
%li= link_to t("layout.build_lists.all"), platform_repository_project_build_lists_path(@platform, @repository, @project)
%li.active= link_to t("layout.build_lists.show"), platform_repository_project_build_list_path(@platform, @repository, @project, @build_list)
.content
.inner
%p
%b
= t("activerecord.attributes.build_list.name")
\:
= @build_list.present? ? @build_list.name : t("layout.build_lists.name_not_yet_defined")
%p
%b
= t("activerecord.attributes.build_list.bs_id")
\:
= @build_list.bs_id
%p
%b
= t("activerecord.attributes.build_list.container_path")
\:
= @build_list.container_path
%p
%b
= t("activerecord.attributes.build_list.status")
\:
= @build_list.human_status
%p
%b
= t("activerecord.attributes.build_list.branch_name")
\:
= @build_list.branch_name
%p
%b
= t("activerecord.attributes.build_list.project")
\:
= @build_list.project.name
%p
%b
= t("activerecord.attributes.build_list.arch")
\:
= @build_list.arch.name
%p
%b
= t("activerecord.attributes.build_list.notified_at")
\:
= @build_list.notified_at
%p
%b
= t("activerecord.attributes.build_list.is_circle")
\:
= t("layout.#{@build_list.is_circle?}_")
%p
%b
= t("activerecord.attributes.build_list.additional_repos")
\:
= @build_list.additional_repos
.block
.content
%h2= t("layout.build_lists.items_header")
.inner
- if @item_groups.blank?
= t("layout.build_lists.no_items_data")
- @item_groups.each_with_index do |group, level|
%h3.title Level ##{level}
%table.table
%tr
%th.first= t("activerecord.attributes.build_list/item.name")
%th.last= t("activerecord.attributes.build_list/item.status")
- group.each do |item|
%tr{:class => cycle("odd", "even")}
%td= item.name
%td.last= item.human_status
- content_for :sidebar, render(:partial => 'sidebar')

View File

@ -0,0 +1,37 @@
.block
.secondary-navigation
%ul.wat-cf
%li.first= link_to t("layout.projects.list"), platform_repository_path(@platform, @repository) + "#projects"
%li= link_to t("layout.projects.new"), new_platform_repository_project_path(@platform, @repository)
%li= link_to t("layout.projects.show"), platform_repository_project_path(@platform, @repository, @project)
%li= link_to "git-repo", platform_repository_project_repo_path(@platform, @repository, @project)
%li.active= link_to t("layout.projects.build"), build_platform_repository_project_path(@platform, @repository, @project)
.content
%h2.title= t("layout.projects.new_build")
.inner
= form_for :build, :url => process_build_platform_repository_project_path(@platform, @repository, @project), :html => { :class => :form, :method => :post } do |f|
.columns.wat-cf
.column.left
.group
= f.label :branch, "Branch", :class => :label
= f.select :branch, @branches.collect{|branch| [branch.name, branch.name]}
.column.right
.group
= f.label :arches, t("activerecord.attributes.build_list.arch"), :class => :label
- @arches.each do |arch|
= f.check_box "arches[#{arch.id}]"
= arch.name
%br
.group.navform.wat-cf
%button.button{:type => "submit"}
= image_tag("web-app-theme/icons/tick.png", :alt => t("layout.projects.build_button"))
= t("layout.projects.build_button")
%span.text_button_padding= t("layout.or")
= link_to t("layout.cancel"), platform_repository_path(@platform, @repository), :class => "text_button_padding link_button"
- content_for :sidebar, render(:partial => 'sidebar')

View File

@ -3,6 +3,9 @@
%ul.wat-cf %ul.wat-cf
%li.first= link_to t("layout.projects.list"), platform_repository_path(@platform, @repository) + "#projects" %li.first= link_to t("layout.projects.list"), platform_repository_path(@platform, @repository) + "#projects"
%li.active= link_to t("layout.projects.new"), new_platform_repository_project_path(@platform, @repository) %li.active= link_to t("layout.projects.new"), new_platform_repository_project_path(@platform, @repository)
%li= link_to "git-repo", platform_repository_project_repo_path(@platform, @repository, @project)
%li= link_to t("layout.projects.build"), build_platform_repository_project_path(@platform, @repository, @project)
.content .content
%h2.title= t("layout.projects.new_header") %h2.title= t("layout.projects.new_header")
.inner .inner

View File

@ -5,6 +5,7 @@
%li= link_to t("layout.projects.new"), new_platform_repository_project_path(@platform, @repository) %li= link_to t("layout.projects.new"), new_platform_repository_project_path(@platform, @repository)
%li.active= link_to t("layout.projects.show"), platform_repository_project_path(@platform, @repository, @project) %li.active= link_to t("layout.projects.show"), platform_repository_project_path(@platform, @repository, @project)
%li= link_to "git-repo", platform_repository_project_repo_path(@platform, @repository, @project) %li= link_to "git-repo", platform_repository_project_repo_path(@platform, @repository, @project)
%li= link_to t("layout.projects.build"), build_platform_repository_project_path(@platform, @repository, @project)
.content .content
.inner .inner

View File

@ -34,24 +34,27 @@ task :symlink_config_files do
run "mkdir -p #{deploy_to}/#{shared_dir}/config" run "mkdir -p #{deploy_to}/#{shared_dir}/config"
run "yes n | cp -i #{release_path}/config/database.yml.sample #{deploy_to}/#{shared_dir}/config/database.yml" run "yes n | cp -i #{release_path}/config/database.yml.sample #{deploy_to}/#{shared_dir}/config/database.yml"
# run "yes n | cp -i #{release_path}/config/config.yml.sample #{deploy_to}/#{shared_dir}/config/config.yml"
run "yes n | cp -i #{release_path}/config/application.yml.sample #{deploy_to}/#{shared_dir}/config/application.yml" run "yes n | cp -i #{release_path}/config/application.yml.sample #{deploy_to}/#{shared_dir}/config/application.yml"
run "ln -nfs #{deploy_to}/#{shared_dir}/config/database.yml #{release_path}/config/database.yml" run "ln -nfs #{deploy_to}/#{shared_dir}/config/database.yml #{release_path}/config/database.yml"
# run "ln -nfs #{deploy_to}/#{shared_dir}/config/config.yml #{release_path}/config/config.yml"
run "ln -nfs #{deploy_to}/#{shared_dir}/config/application.yml #{release_path}/config/application.yml" run "ln -nfs #{deploy_to}/#{shared_dir}/config/application.yml #{release_path}/config/application.yml"
end end
namespace :deploy do namespace :deploy do
desc "Restarting mod_rails with restart.txt" desc "Restarting mod_rails with restart.txt"
task :restart, :roles => :app, :except => { :no_release => true } do task :restart, :roles => :app, :except => { :no_release => true } do
run "cd #{deploy_to}/current ; ([ -f tmp/pids/unicorn.pid ] && kill -USR2 `cat tmp/pids/unicorn.pid`); true" run "cd #{deploy_to}/current ; ([ -f tmp/pids/unicorn.pid ] && kill -USR2 `cat tmp/pids/unicorn.pid`); true"
restart_dj
end end
%w(start).each { |name| task name, :roles => :app do deploy.restart end } %w(start).each { |name| task name, :roles => :app do deploy.restart end }
desc "Restart delayed job"
task :restart_dj, :roles => :web do
run "cd #{deploy_to}/current ; RAILS_ENV=production ./script/delayed_job stop; RAILS_ENV=production ./script/delayed_job start; true"
end
desc "Rude restart application" desc "Rude restart application"
task :rude_restart, :roles => :web do task :rude_restart, :roles => :web do
run "cd #{deploy_to}/current ; pkill unicorn; sleep 0.5; pkill -9 unicorn; sleep 0.5 ; unicorn_rails -c config/unicorn.rb -E production -D " run "cd #{deploy_to}/current ; pkill unicorn; sleep 0.5; pkill -9 unicorn; sleep 0.5 ; unicorn_rails -c config/unicorn.rb -E production -D "
@ -64,9 +67,7 @@ namespace :deploy do
envs = "RAILS_ENV=production" envs = "RAILS_ENV=production"
# Precaching assets # Precaching assets
run_locally "bash -c '" + run_locally "bash -c '#{envs} jammit'"
# "#{envs} compass compile && " +
"#{envs} jammit'"
# Uploading prechached assets # Uploading prechached assets
top.upload assets_path, "#{current_release}/public", :via => :scp, :recursive => true top.upload assets_path, "#{current_release}/public", :via => :scp, :recursive => true

View File

@ -16,6 +16,8 @@ ru:
or: или or: или
yes_: Да yes_: Да
no_: Нет no_: Нет
true_: Да
false_: Нет
menu: menu:
users: Пользователи users: Пользователи
platforms: Платформы platforms: Платформы
@ -62,15 +64,17 @@ ru:
list: Список list: Список
list_header: Проекты list_header: Проекты
show: Проект show: Проект
build: Собрать
new_build: Новая сборка
confirm_delete: Вы уверены, что хотите удалить этот проект? confirm_delete: Вы уверены, что хотите удалить этот проект?
new: Новый проект new: Новый проект
new_header: Новый проект new_header: Новый проект
new_header: Новый проект new_header: Новый проект
location: Расположение location: Расположение
git_repo_location: Путь к git-репозиторию git_repo_location: Путь к git-репозиторию
back_to_the_list: К списку проектов репозитория
current_project_header: Текущий проект current_project_header: Текущий проект
current_build_lists: Текущие сборки current_build_lists: Текущие сборки
build_button: Начать сборку
users: users:
list: Список list: Список
new: Создать new: Создать
@ -96,14 +100,30 @@ ru:
created_at_end: "Время постановки на сборку по:" created_at_end: "Время постановки на сборку по:"
notified_at_start: "Время последнего обновления от BS с:" notified_at_start: "Время последнего обновления от BS с:"
notified_at_end: "Время последнего обновления от BS по:" notified_at_end: "Время последнего обновления от BS по:"
bs_id_not_set: Id еще не присвоен
items_header: Элементы сборки
no_items_data: Данных нет
show: Просмотр
items:
statuses:
build_error: ошибка сборки
mock_not_found: mock не найден
dependencies_fail: dependencies fail
srpm_not_found: srpm не найден
success: собран
statuses: statuses:
build_error: ошибка сборки build_error: ошибка сборки
mock_not_found: mock не найден mock_not_found: mock не найден
dependencies_fail: dependencies fail dependencies_fail: dependencies fail
srpm_not_found: srpm не найден srpm_not_found: srpm не найден
waiting_for_response: ожидает ответа
build_pending: ожидает сборку build_pending: ожидает сборку
success: собран success: собран
build_started: собирается build_started: собирается
platform_not_found: платформа не найдена
platform_pending: платформа в процессе создания
project_not_found: проект не найден
branch_not_found: бранч не найден
flash: flash:
project: project:
@ -126,7 +146,13 @@ ru:
unfreezed: Платформа успешно разморожена unfreezed: Платформа успешно разморожена
unfreeze_error: Не удалось разморозить платформу, попробуйте еще раз unfreeze_error: Не удалось разморозить платформу, попробуйте еще раз
destroyed: Платформа успешно удалена destroyed: Платформа успешно удалена
build_list:
saved: Билд лист для бранча '%{branch_name}' и архитектуры '%{arch}' создан успешно
save_error: Не удалось сохранить билд лист для бранча '%{branch_name}' и архитектуры '%{arch}'
no_branch_selected: Выберите какой-нибудь бранч
no_branch_found: Выбранный бранч '%{branch_name}' не найден
no_arch_selected: Выберите хотя бы одну ахритектуру
no_arch_found: Выбранные ахритектуры не найдены
attributes: attributes:
password: Пароль password: Пароль
@ -147,6 +173,8 @@ ru:
rpm: RPM rpm: RPM
user: Пользователь user: Пользователь
product: Продукт product: Продукт
build_list: Сборочный лист
build_list_item: Элемент сборочного листа
attributes: attributes:
repository: repository:
@ -217,6 +245,7 @@ ru:
build_list: build_list:
bs_id: Id bs_id: Id
name: Название
container_path: Путь до контейнера container_path: Путь до контейнера
status: Статус status: Статус
branch_name: Branch branch_name: Branch
@ -226,5 +255,12 @@ ru:
arch: Архитектура arch: Архитектура
is_circle: Циклическая сборка is_circle: Циклическая сборка
notified_at: Информация получена notified_at: Информация получена
additional_repos: Дополнительные репозитории
updated_at: Обновлен updated_at: Обновлен
created_at: Создан created_at: Создан
build_list/item:
name: Название
level: Уровень
status: Статус
build_list: Сборочный лист

View File

@ -12,12 +12,18 @@ Rosa::Application.routes.draw do
resources :repositories do resources :repositories do
resources :projects do resources :projects do
resource :repo, :controller => "git/repositories", :only => [:show] resource :repo, :controller => "git/repositories", :only => [:show]
resources :build_lists, :only => [:index] do resources :build_lists, :only => [:index, :show] do
collection do collection do
get :recent get :recent
post :filter post :filter
end end
end end
member do
get :build
post :process_build
end
end end
end end
end end

View File

@ -0,0 +1,21 @@
class CreateBuildListItems < ActiveRecord::Migration
def self.up
create_table :build_list_items, :force => true do |t|
t.string :name
t.integer :level
t.integer :status
t.integer :build_list_id
t.timestamps
end
add_index :build_list_items, :build_list_id
end
def self.down
remove_index :build_list_items, :build_list_id
drop_table :build_list_items
end
end

View File

@ -0,0 +1,9 @@
class AddAdditionalReposToBuildLists < ActiveRecord::Migration
def self.up
add_column :build_lists, :additional_repos, :text
end
def self.down
remove_column :build_lists, :additional_repos
end
end

View File

@ -0,0 +1,9 @@
class AddNameToBuildLists < ActiveRecord::Migration
def self.up
add_column :build_lists, :name, :string
end
def self.down
remove_column :build_lists, :name
end
end

View File

@ -0,0 +1,21 @@
class CreateDelayedJobs < ActiveRecord::Migration
def self.up
create_table :delayed_jobs, :force => true do |table|
table.integer :priority, :default => 0 # Allows some jobs to jump to the front of the queue
table.integer :attempts, :default => 0 # Provides for retries, but still fail eventually.
table.text :handler # YAML-encoded string of the object that will do work
table.text :last_error # reason for last failure (See Note below)
table.datetime :run_at # When to run. Could be Time.zone.now for immediately, or sometime in the future.
table.datetime :locked_at # Set when a client is working on this object
table.datetime :failed_at # Set when all retries have failed (actually, by default, the record is deleted instead)
table.string :locked_by # Who is working on this object (if locked)
table.timestamps
end
add_index :delayed_jobs, [:priority, :run_at], :name => 'delayed_jobs_priority'
end
def self.down
drop_table :delayed_jobs
end
end

View File

@ -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 => 20110411125015) do ActiveRecord::Schema.define(:version => 20110411160955) 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
@ -20,6 +20,17 @@ ActiveRecord::Schema.define(:version => 20110411125015) do
add_index "arches", ["name"], :name => "index_arches_on_name", :unique => true add_index "arches", ["name"], :name => "index_arches_on_name", :unique => true
create_table "build_list_items", :force => true do |t|
t.string "name"
t.integer "level"
t.integer "status"
t.integer "build_list_id"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "build_list_items", ["build_list_id"], :name => "index_build_list_items_on_build_list_id"
create_table "build_lists", :force => true do |t| create_table "build_lists", :force => true do |t|
t.integer "bs_id" t.integer "bs_id"
t.string "container_path" t.string "container_path"
@ -30,7 +41,9 @@ ActiveRecord::Schema.define(:version => 20110411125015) 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 t.boolean "is_circle", :default => false
t.text "additional_repos"
t.string "name"
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"
@ -45,6 +58,21 @@ ActiveRecord::Schema.define(:version => 20110411125015) do
t.datetime "updated_at" t.datetime "updated_at"
end end
create_table "delayed_jobs", :force => true do |t|
t.integer "priority", :default => 0
t.integer "attempts", :default => 0
t.text "handler"
t.text "last_error"
t.datetime "run_at"
t.datetime "locked_at"
t.datetime "failed_at"
t.string "locked_by"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority"
create_table "platforms", :force => true do |t| create_table "platforms", :force => true do |t|
t.string "name" t.string "name"
t.string "unixname" t.string "unixname"

5
script/delayed_job Executable file
View File

@ -0,0 +1,5 @@
#!/usr/bin/env ruby
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'config', 'environment'))
require 'delayed/command'
Delayed::Command.new(ARGV).daemonize