Merge pull request #748 from warpc/735-fetch-data-for-container
[refs #735]: fill packages of BuildList when use new_core
This commit is contained in:
commit
d39c07475f
|
@ -60,7 +60,11 @@ module BuildListsHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def container_url
|
def container_url
|
||||||
"http://#{request.host_with_port}/downloads#{@build_list.container_path}".html_safe
|
if @build_list.new_core?
|
||||||
|
@build_list.container_path
|
||||||
|
else
|
||||||
|
"http://#{request.host_with_port}/downloads#{@build_list.container_path}".html_safe
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def build_list_log_url(log_type)
|
def build_list_log_url(log_type)
|
||||||
|
|
|
@ -138,46 +138,47 @@
|
||||||
= submit_tag t("layout.reject_publish"), :confirm => t("layout.confirm"), :name => 'reject_publish'
|
= submit_tag t("layout.reject_publish"), :confirm => t("layout.confirm"), :name => 'reject_publish'
|
||||||
|
|
||||||
.hr
|
.hr
|
||||||
- if @build_list.new_core?
|
%h3= t("layout.build_lists.items_header")
|
||||||
= render 'platforms/product_build_lists/results', :pbl => @build_list
|
- if @item_groups.blank?
|
||||||
- else
|
%h4.nomargin= t("layout.build_lists.no_items_data")
|
||||||
%h3= t("layout.build_lists.items_header")
|
- @item_groups.each_with_index do |group, level|
|
||||||
- if @item_groups.blank?
|
- group.each do |item|
|
||||||
%h4.nomargin= t("layout.build_lists.no_items_data")
|
%h4.nomargin= "#{item.name} ##{level}"
|
||||||
- @item_groups.each_with_index do |group, level|
|
|
||||||
- group.each do |item|
|
|
||||||
%h4.nomargin= "#{item.name} ##{level}"
|
|
||||||
%table.tablesorter.width565{:cellpadding => "0", :cellspacing => "0"}
|
|
||||||
%thead
|
|
||||||
%tr
|
|
||||||
%th= t("activerecord.attributes.build_list/item.name")
|
|
||||||
%th= t("activerecord.attributes.build_list/item.version")
|
|
||||||
%th= t("activerecord.attributes.build_list/item.status")
|
|
||||||
%tbody
|
|
||||||
%tr{:class => build_list_item_status_color(item.status)}
|
|
||||||
%td= item.name
|
|
||||||
%td= item.version
|
|
||||||
%td= item.human_status
|
|
||||||
.both
|
|
||||||
|
|
||||||
- if @build_list.packages.present?
|
|
||||||
.hr
|
|
||||||
%h3= t("layout.build_lists.packages_header")
|
|
||||||
%table.tablesorter.width565{:cellpadding => "0", :cellspacing => "0"}
|
%table.tablesorter.width565{:cellpadding => "0", :cellspacing => "0"}
|
||||||
%thead
|
%thead
|
||||||
%tr
|
%tr
|
||||||
%th= t("activerecord.attributes.build_list/package.fullname")
|
%th= t("activerecord.attributes.build_list/item.name")
|
||||||
%th= t("activerecord.attributes.build_list/package.name")
|
%th= t("activerecord.attributes.build_list/item.version")
|
||||||
%th= t("activerecord.attributes.build_list/package.version")
|
%th= t("activerecord.attributes.build_list/item.status")
|
||||||
%th= t("activerecord.attributes.build_list/package.release")
|
|
||||||
%tbody
|
%tbody
|
||||||
- @build_list.packages.each do |package|
|
%tr{:class => build_list_item_status_color(item.status)}
|
||||||
%tr
|
%td= item.name
|
||||||
%td= package.fullname
|
%td= item.version
|
||||||
%td= package.name
|
%td= item.human_status
|
||||||
%td= package.version
|
.both
|
||||||
%td= package.release
|
|
||||||
.both
|
- if @build_list.packages.present?
|
||||||
|
.hr
|
||||||
|
%h3= t("layout.build_lists.packages_header")
|
||||||
|
%table.tablesorter.width565{:cellpadding => "0", :cellspacing => "0"}
|
||||||
|
%thead
|
||||||
|
%tr
|
||||||
|
%th= t("activerecord.attributes.build_list/package.fullname")
|
||||||
|
%th= t("activerecord.attributes.build_list/package.name")
|
||||||
|
%th= t("activerecord.attributes.build_list/package.version")
|
||||||
|
%th= t("activerecord.attributes.build_list/package.release")
|
||||||
|
%tbody
|
||||||
|
- @build_list.packages.each do |package|
|
||||||
|
%tr
|
||||||
|
%td= package.fullname
|
||||||
|
%td= package.name
|
||||||
|
%td= package.version
|
||||||
|
%td= package.release
|
||||||
|
.both
|
||||||
|
|
||||||
|
- if @build_list.new_core?
|
||||||
|
.hr
|
||||||
|
= render 'platforms/product_build_lists/results', :pbl => @build_list
|
||||||
|
|
||||||
:javascript
|
:javascript
|
||||||
$('article .all').addClass('bigpadding');
|
$('article .all').addClass('bigpadding');
|
||||||
|
|
|
@ -5,19 +5,52 @@ module AbfWorker
|
||||||
def self.perform(options)
|
def self.perform(options)
|
||||||
bl = BuildList.find options['id']
|
bl = BuildList.find options['id']
|
||||||
status = options['status'].to_i
|
status = options['status'].to_i
|
||||||
|
item = find_or_create_item(bl)
|
||||||
case status
|
case status
|
||||||
when 0
|
when 0
|
||||||
bl.build_success
|
bl.build_success
|
||||||
|
item.update_attributes({:status => BuildServer::SUCCESS})
|
||||||
when 1
|
when 1
|
||||||
bl.build_error
|
bl.build_error
|
||||||
|
item.update_attributes({:status => BuildServer::BUILD_ERROR})
|
||||||
when 3
|
when 3
|
||||||
bl.bs_id = bl.id
|
bl.bs_id = bl.id
|
||||||
bl.save
|
bl.save!
|
||||||
bl.start_build
|
bl.start_build
|
||||||
end
|
end
|
||||||
if status != 3
|
if status != 3
|
||||||
|
fill_container_data bl, options
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
class << self
|
||||||
|
protected
|
||||||
|
|
||||||
|
def find_or_create_item(bl)
|
||||||
|
bl.items.first || bl.items.create({
|
||||||
|
:version => bl.project_version,
|
||||||
|
:name => bl.project.name,
|
||||||
|
:status => BuildServer::BUILD_STARTED,
|
||||||
|
:level => 0
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
def fill_container_data(bl, options)
|
||||||
|
packages = options['packages'] || []
|
||||||
|
packages.each do |package|
|
||||||
|
package = bl.packages.build(package)
|
||||||
|
package.package_type = package['fullname'] =~ /.*\.src\.rpm$/ ? 'source' : 'binary'
|
||||||
|
package.project_id = bl.project_id
|
||||||
|
package.platform_id = bl.save_to_platform_id
|
||||||
|
package.save!
|
||||||
|
end
|
||||||
|
|
||||||
|
container = (options['results'] || []).
|
||||||
|
select{ |r| r['file_name'] !~ /.*\.log$/ }.first
|
||||||
|
sha1 = container ? container['sha1'] : nil
|
||||||
bl.results = options['results']
|
bl.results = options['results']
|
||||||
bl.save
|
bl.container_path = "http://file-store.rosalinux.ru/api/v1/file_stores/#{sha1}" if sha1
|
||||||
|
bl.save!
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue