Merge branch 'master' into staging
Conflicts: app/models/build_list.rb
This commit is contained in:
commit
4d78ce371f
|
@ -128,7 +128,7 @@ class BuildListsController < ApplicationController
|
|||
|
||||
def find_project_versions
|
||||
@git_repository = @project.git_repository
|
||||
@project_versions = @project.project_versions
|
||||
@project_versions = @project.collected_project_versions
|
||||
end
|
||||
|
||||
def find_build_list_by_bs
|
||||
|
|
|
@ -18,7 +18,7 @@ class PlatformsController < ApplicationController
|
|||
{:name => p.unixname,
|
||||
:architectures => ['i586', 'x86_64'],
|
||||
:repositories => p.repositories.map(&:unixname),
|
||||
:url => "http://#{request.host_with_port}/downloads/platforms/#{p.unixname}/repository"}
|
||||
:url => "http://#{request.host_with_port}/downloads/#{p.unixname}/repository/"}
|
||||
end
|
||||
}
|
||||
end
|
||||
|
|
|
@ -64,21 +64,12 @@ class ProjectsController < ApplicationController
|
|||
uname, unixname = params[:git_repo].split('/')
|
||||
owner = User.find_by_uname(uname) || Group.find_by_uname(uname)
|
||||
project = Project.where(:owner_id => owner.id, :owner_type => owner.class).find_by_unixname!(unixname)
|
||||
auto_build_list = AutoBuildList.find_by_project_id(project.id)
|
||||
project.delay.auto_build # TODO don't queue duplicates
|
||||
|
||||
# p = params.delete_if{|k,v| k == 'controller' or k == 'action'}
|
||||
# ActiveSupport::Notifications.instrument("event_log.observer", :object => project, :message => p.inspect)
|
||||
logger.info "Git hook recieved from #{params[:git_user]} to #{params[:git_repo]}"
|
||||
|
||||
BuildList.create!(
|
||||
:project => project,
|
||||
:pl => auto_build_list.pl,
|
||||
:bpl => auto_build_list.bpl,
|
||||
:arch => auto_build_list.arch,
|
||||
:project_version => project.collected_project_versions.last.try(:first),
|
||||
:build_requires => true,
|
||||
:update_type => 'bugfix') if auto_build_list
|
||||
|
||||
render :nothing => true
|
||||
end
|
||||
|
||||
|
|
|
@ -25,8 +25,8 @@ class BuildList < ActiveRecord::Base
|
|||
WAITING_FOR_RESPONSE = 4000
|
||||
BUILD_PENDING = 2000
|
||||
BUILD_STARTED = 3000
|
||||
TEST_FAILD = 21
|
||||
BUILD_PUBLISHED = 6000
|
||||
TEST_FAILD = 21
|
||||
|
||||
STATUSES = [WAITING_FOR_RESPONSE,
|
||||
BuildServer::SUCCESS,
|
||||
|
|
|
@ -51,21 +51,23 @@ class Platform < ActiveRecord::Base
|
|||
def urpmi_list(host, pair = nil)
|
||||
blank_pair = {:login => 'login', :pass => 'password'}
|
||||
pair = blank_pair if pair.blank?
|
||||
urpmi_commands = []
|
||||
|
||||
pls = Platform.main.open
|
||||
#pls << self
|
||||
pls.each do |pl|
|
||||
urpmi_commands = ActiveSupport::OrderedHash.new
|
||||
|
||||
Platform.main.open.each do |pl|
|
||||
urpmi_commands[pl.name] = []
|
||||
local_pair = pl.id != self.id ? blank_pair : pair
|
||||
#tail = (pl.id != self.id && pl.distrib_type == APP_CONFIG['distr_types'].first) ? "/$ARCH/main/release" : ""
|
||||
tail = (pl.distrib_type == APP_CONFIG['distr_types'].first) ? "/$ARCH/main/release" : ""
|
||||
head = self.hidden? ? "http://#{ local_pair[:login] }@#{ local_pair[:pass] }:#{ host }/private/" : "http://#{ host }/downloads/"
|
||||
urpmi_commands << [
|
||||
"urpmi.addmedia #{ head }#{ self.unixname }/repository/#{ pl.unixname }#{ tail }",
|
||||
pl.name
|
||||
]
|
||||
head = hidden? ? "http://#{local_pair[:login]}@#{local_pair[:pass]}:#{host}/private/" : "http://#{host}/downloads/"
|
||||
if pl.distrib_type == APP_CONFIG['distr_types'].first
|
||||
Arch.all.each do |arch|
|
||||
tail = "/#{arch.name}/main/release"
|
||||
urpmi_commands[pl.name] << "urpmi.addmedia #{unixname} #{head}#{unixname}/repository/#{pl.unixname}#{tail}"
|
||||
end
|
||||
else
|
||||
tail = ''
|
||||
urpmi_commands[pl.name] << "urpmi.addmedia #{unixname} #{head}#{unixname}/repository/#{pl.unixname}#{tail}"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
return urpmi_commands
|
||||
end
|
||||
|
||||
|
|
|
@ -42,18 +42,30 @@ class Project < ActiveRecord::Base
|
|||
after_destroy :destroy_git_repo
|
||||
after_rollback lambda { destroy_git_repo rescue true if new_record? }
|
||||
|
||||
def auto_build
|
||||
auto_build_lists.each do |auto_build_list|
|
||||
build_lists.create(
|
||||
:pl => auto_build_list.pl,
|
||||
:bpl => auto_build_list.bpl,
|
||||
:arch => auto_build_list.arch,
|
||||
:project_version => collected_project_versions.last,
|
||||
:build_requires => true,
|
||||
:update_type => 'bugfix') unless build_lists.for_creation_date_period(Time.current - 15.seconds, Time.current).present?
|
||||
end
|
||||
end
|
||||
|
||||
def project_versions
|
||||
res = tags.select { |tag| tag.name =~ /^v\./ }
|
||||
res = tags.select{|tag| tag.name =~ /^v\./}
|
||||
return res if res and res.size > 0
|
||||
tags
|
||||
end
|
||||
|
||||
|
||||
def collected_project_versions
|
||||
project_versions.collect { |tag| new_tag = tag.name.gsub(/^\w+\./, ""); [new_tag, new_tag] }
|
||||
project_versions.collect{|tag| tag.name.gsub(/^\w+\./, "")}
|
||||
end
|
||||
|
||||
def tags
|
||||
self.git_repository.tags
|
||||
self.git_repository.tags.sort_by{|t| t.name.gsub(/[a-zA-Z.]+/, '').to_i}
|
||||
end
|
||||
|
||||
def members
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
- if @project_versions
|
||||
.group
|
||||
= f.label :project_version, t("activerecord.attributes.build_list.project_version"), :class => :label
|
||||
= f.select :project_version, @project_versions.collect{|project_version| [project_version.name, project_version.name]}, :include_blank => true, :selected => @filter.project_version
|
||||
= f.select :project_version, @project_versions, :include_blank => true, :selected => @filter.project_version
|
||||
|
||||
.group
|
||||
= f.label :is_circle, t("activerecord.attributes.build_list.is_circle"), :class => :label
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
.group
|
||||
%span Данные для подключения:
|
||||
.group{:style => 'padding-left: 10px'}
|
||||
- urpmi_commands.each do |urpmi_command|
|
||||
= urpmi_command[1] + ":"
|
||||
- urpmi_commands.each do |platform, commands|
|
||||
#{platform}:
|
||||
.group{:style => 'padding-left: 20px'}
|
||||
%span= urpmi_command[0]
|
||||
%br
|
||||
- commands.each do |command|
|
||||
%span= command
|
||||
%br
|
||||
%br
|
|
@ -26,6 +26,8 @@ set :scm, "git"
|
|||
set :user, "rosa"
|
||||
set :use_sudo, false
|
||||
set :deploy_to, "/srv/#{application}"
|
||||
# set :deploy_via, :copy
|
||||
# set :copy_cache, true
|
||||
|
||||
set :keep_releases, 3
|
||||
|
||||
|
|
Loading…
Reference in New Issue